Kong / Kong/insomnia

Error when cloning repository with no `.insomnia/` on the default branch

Open
#6,102 2 comments 8 reactions 0 assignees View on GitHub
B-bug S-unverified
Dominant language
TypeScript
Stars
40k
Forks
2.4k
Avg merge
2d 13h
Merged PRs (30d)
61

Description

### Expected Behavior

Cloning a repository that does not contain an API spec in the default branch while it does exist in a non-default branch should load and allow to switch branches.

### Actual Behavior

When cloning a repository with `+ Create > Git clone` that contains an Insomnia API spec (`.insomnia/`) on a non-default branch (e.g. `dev`) and nothing on the default branch (i.e. `main`), the Insomnia desktop application shows the following error. I have not found a way to switch branches to the appropriate one from this window.

![image](https://github.com/Kong/insomnia/assets/132559998/c8670822-b319-4fe8-b654-18eed964fdf1)

Clicking on `Try to reload the app` brings you back to the dashboard, but opening the associated document again will show the same window.

### Reproduction Steps

I have published a minimum reproducible example in [`APEX-JOAQUIN-ROVIRA/TestRepo`](https://github.com/APEX-JOAQUIN-ROVIRA/TestRepo). This repository contains a `main` branch without an `.insomnia/` directory. There is a non-default branch `dev` that contains an example API spec in the `.insomnia/` directory.

Steps:

1. Clone the repository with the `+ Create > Git clone` menu option.
2. Add any (valid) GitHub credentials as the repo is public.
3. The error window will pop up.

### Is there an existing issue for this?

- [X] I have searched the [issue tracker](https://www.github.com/Kong/insomnia/issues) for this problem.

### Additional Information

```
Version: Insomnia 2023.4.0
Build date: 4/7/2023
OS: Windows_NT x64 10.0.19042
Electron: 23.3.9
Node: 18.12.1
V8: 11.0.226.20-electron.0
Architecture: x64
```

### Insomnia Version

2023.4.0

### What operating system are you using?

Windows

### Operating System Version

Windows_NT x64 10.0.19042

### Installation method

insomia.rest

### Last Known Working Insomnia version

N/A

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the linked TestRepo through + Create > Git clone, using its main and dev branches. Trace the Git clone flow that handles a repository without .insomnia/ on the default branch; done means the app loads the repository and provides a way to switch to the branch containing the API spec.

Written by the indexing model from the issue text.

Assessment

Tech stack
electron, git, typescript
Domain
desktop, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.