{"record":{"id":"e6965cd5c793bc1c","repo":"chenhg5/cc-connect","slug":"path-does-not-exist","errorCode":null,"errorMessage":"path does not exist","messagePattern":"path does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/reference_show.go","lineNumber":77,"sourceCode":"\t}\n\treturn req, nil\n}\n\nfunc renderReferenceView(req *referenceViewRequest) (string, error) {\n\tif req == nil || req.Ref == nil {\n\t\treturn \"\", fmt.Errorf(\"nil view request\")\n\t}\n\tpath := req.Ref.pathAbs\n\tif path == \"\" {\n\t\tpath = req.Ref.pathOriginal\n\t}\n\tif path == \"\" {\n\t\treturn \"\", fmt.Errorf(\"empty path\")\n\t}\n\tinfo, err := os.Stat(path)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn \"\", fmt.Errorf(\"path does not exist\")\n\t\t}\n\t\treturn \"\", err\n\t}\n\tif info.IsDir() {\n\t\tif req.Ref.locationFormat != referenceLocationNone {\n\t\t\treturn \"\", fmt.Errorf(\"directory reference cannot carry a location\")\n\t\t}\n\t\treturn renderReferenceDir(path, req)\n\t}\n\treturn renderReferenceFile(path, req)\n}\n\nfunc renderReferenceFile(path string, req *referenceViewRequest) (string, error) {\n\tvar (\n\t\tlines     []string\n\t\ttruncated bool\n\t\terr       error\n\t\tnote      string","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/reference_show.go#L59-L95","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before\nshow(\"old_notes.go\") // file was deleted\n// after\nif _, err := os.Stat(\"old_notes.go\"); err != nil {\n    // re-add or pick an existing file\n}\nshow(\"notes.go\")","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(path); err != nil {\n    return fmt.Errorf(\"cannot show %s: %w\", path, err)\n}","typeGuard":"func pathExists(p string) bool { _, err := os.Stat(p); return err == nil }","tryCatchPattern":"out, err := renderReferenceView(req)\nif err != nil && strings.Contains(err.Error(), \"path does not exist\") {\n    return \"reference no longer exists on disk\", nil\n}","preventionTips":["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"],"tags":["go","filesystem","stat"],"backgroundTag":"file-not-found","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}