Skip to content

Sync fails with "An unknown error occurred" when git remote origin is not configured #349

@hidetaka-cci

Description

@hidetaka-cci

When running chunk sidecar setup on a project initialized with git init (no remote configured), the sync step fails with a generic error message that gives no actionable guidance.

Steps to reproduce

mkdir my-project && cd my-project
git init
chunk init
chunk sidecar setup

Expected behavior

The CLI detects that origin is not configured before attempting sync and exits with an actionable message, for example:

✗ Error: Git remote "origin" is required for sidecar sync.
  Run: git remote add origin <url>

Actual behavior

✗ Error: An unknown error occurred.

sync: git remote get-url origin: exit status 2

The root cause is buried in the detail line. The top-level message provides no indication of what went wrong or how to fix it.

Root cause

DetectOrgAndRepo() fails when origin is absent. This error is wrapped as a plain sync: ... error and returned, but the userError conversion in sidecar setup only handles *sidecar.RemoteBaseError. All other errors fall through to the generic "An unknown error occurred." default in main.go.

Suggested fix

Wrap DetectOrgAndRepo failures as a userError with a specific message and suggestion, for example:

msg:        "Git remote \"origin\" is required for sidecar sync."
suggestion: "Run: git remote add origin <url>"

A prerequisites check for git remote get-url origin before the sync step would also prevent the issue entirely.

Workaround

git remote add origin git@github.com:<org>/<repo>.git
git push origin main
# then re-run chunk sidecar setup

Environment

  • chunk-cli version: 1.2.0 (also reproduced on 1.3.0)
  • OS: macOS
  • Project created via: git init (not git clone)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions