{"record":{"id":"520ae60b1a34de75","repo":"chenhg5/cc-connect","slug":"s-w","errorCode":null,"errorMessage":"%s: %w","messagePattern":"%s: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":17052,"sourceCode":"\t\tremainder := url[idx+1:]\n\t\tparts := strings.Split(remainder, \"/\")\n\t\tif len(parts) > 0 {\n\t\t\treturn parts[len(parts)-1]\n\t\t}\n\t}\n\t// Handle https://host/org/repo format\n\tparts := strings.Split(url, \"/\")\n\tif len(parts) > 0 {\n\t\treturn parts[len(parts)-1]\n\t}\n\treturn \"workspace\"\n}\n\nfunc gitClone(repoURL, dest string) error {\n\tcmd := exec.Command(\"git\", \"clone\", repoURL, dest)\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%s: %w\", strings.TrimSpace(string(output)), err)\n\t}\n\treturn nil\n}\n\n// ── Context usage indicator ──────────────────────────────────\n\nconst modelContextWindow = 200_000 // generic fallback window for heuristic context estimates\n\nfunc contextIndicatorText(inputTokens int) string {\n\tif inputTokens <= 0 {\n\t\treturn \"\"\n\t}\n\tpct := inputTokens * 100 / modelContextWindow\n\tif pct > 100 {\n\t\tpct = 100\n\t}\n\treturn fmt.Sprintf(\"[ctx: ~%d%%]\", pct)\n}","sourceCodeStart":17034,"sourceCodeEnd":17070,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L17034-L17070","documentation":"gitClone runs `git clone <repoURL> <dest>` and, on failure, wraps git's combined stderr/stdout output around the returned error. The developer sees what git itself printed (e.g. 'fatal: repository not found') followed by the underlying exec error.","triggerScenarios":"Calling gitClone where the git subprocess exits non-zero: unreachable or nonexistent repository URL, authentication failure on a private repo, destination directory already exists and is non-empty, no network access, or git binary not installed.","commonSituations":"Typo'd or renamed repo URL; missing deploy key / credentials for private repos; destination path already cloned; firewall blocking github.com; minimal container image without git installed.","solutions":["Read the prefixed git output in the error — it usually states the exact cause (auth, not found, exists)","Verify the repo URL is reachable: git ls-remote <repoURL>","Set up credentials (SSH key, token) for private repositories","Ensure the destination directory does not already exist or is empty","Install git in the runtime environment"],"exampleFix":"// before: no authentication configured\ngitClone(\"git@github.com:org/private.git\", dest)\n// after: use an authenticated HTTPS URL or configure a deploy key\ngitClone(\"https://x-access-token:<token>@github.com/org/private.git\", dest)","handlingStrategy":"try-catch","validationCode":"if _, err := exec.LookPath(\"git\"); err != nil {\n    return fmt.Errorf(\"git not installed\")\n}\nif err := exec.Command(\"git\", \"ls-remote\", repoURL).Run(); err != nil {\n    return fmt.Errorf(\"repo unreachable: %w\", err)\n}\nif _, err := os.Stat(dest); err == nil {\n    return fmt.Errorf(\"destination %s already exists\", dest)\n}","typeGuard":null,"tryCatchPattern":"if err := gitClone(repoURL, dest); err != nil {\n    slog.Error(\"git clone failed\", \"repo\", core.RedactToken(repoURL), \"err\", err)\n    return err\n}","preventionTips":["Pre-check reachability with git ls-remote before cloning","Ensure credentials (SSH keys/tokens) exist in the runtime environment","Verify the destination does not already exist","Install git in container images used by the daemon"],"tags":["git","clone","subprocess"],"backgroundTag":"git-command-failed","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}