chenhg5/cc-connect · error
path does not exist
Error message
path does not exist
What it means
renderReferenceView calls os.Stat on the resolved path; if the path does not exist on disk it returns a friendly 'path does not exist' error (wrapping other stat errors as-is). This guards against rendering stale or mistyped file references.
Source
Thrown at core/reference_show.go:77
}
return req, nil
}
func renderReferenceView(req *referenceViewRequest) (string, error) {
if req == nil || req.Ref == nil {
return "", fmt.Errorf("nil view request")
}
path := req.Ref.pathAbs
if path == "" {
path = req.Ref.pathOriginal
}
if path == "" {
return "", fmt.Errorf("empty path")
}
info, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
return "", fmt.Errorf("path does not exist")
}
return "", err
}
if info.IsDir() {
if req.Ref.locationFormat != referenceLocationNone {
return "", fmt.Errorf("directory reference cannot carry a location")
}
return renderReferenceDir(path, req)
}
return renderReferenceFile(path, req)
}
func renderReferenceFile(path string, req *referenceViewRequest) (string, error) {
var (
lines []string
truncated bool
err error
note stringView on GitHub (pinned to 4000b2338a)
Solutions
- Verify the file exists at the resolved path before calling cmdShow (ls / os.Stat)
- Re-create the reference against the current workspace so pathAbs points at a live file
- Check the process working directory if the reference uses a relative path
Example fix
// before
show("old_notes.go") // file was deleted
// after
if _, err := os.Stat("old_notes.go"); err != nil {
// re-add or pick an existing file
}
show("notes.go") Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Stat(path); err != nil {
return fmt.Errorf("cannot show %s: %w", path, err)
} Type guard
func pathExists(p string) bool { _, err := os.Stat(p); return err == nil } Try / catch
out, err := renderReferenceView(req)
if err != nil && strings.Contains(err.Error(), "path does not exist") {
return "reference no longer exists on disk", nil
} Prevention
- Re-resolve references against the live workspace right before showing
- Avoid checking out/sharing references across different workspaces
- Verify spelling with ls/tab-completion before issuing /show
When it happens
Trigger: os.Stat returns an error satisfying os.IsNotExist — the referenced file/directory was deleted, renamed, or the path was never correct (including wrong working directory for relative paths).
Common situations: User sends /show for a file that has since been removed; reference captured in one workspace but resolved in another; typo in the path; relative path resolved against an unexpected cwd.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- create Agy permission overlay: %w
- read existing Agy hooks %s: %w
- write Agy hooks overlay: %w
- read Agy config directory %s: %w
- link Agy config %s: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/e6965cd5c793bc1c.
Report an issue: GitHub.