{"record":{"id":"cf920fe60ea259b9","repo":"alibaba/open-code-review","slug":"stat-file-q-w","errorCode":null,"errorMessage":"stat file %q: %w","messagePattern":"stat file %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/diff/workspace_file.go","lineNumber":38,"sourceCode":"\t\treturn nil, fmt.Errorf(\"file path %q must be relative, not absolute\", relPath)\n\t}\n\n\tfullPath := filepath.Join(repoRoot, relPath)\n\tif !pathutil.WithinBase(repoRoot, fullPath) {\n\t\treturn nil, fmt.Errorf(\"file path %q is outside repository\", relPath)\n\t}\n\n\tparent, err := filepath.EvalSymlinks(filepath.Dir(fullPath))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"resolve parent path for %q: %w\", relPath, err)\n\t}\n\tif !pathutil.WithinBase(repoRoot, parent) {\n\t\treturn nil, fmt.Errorf(\"file path %q is outside repository\", relPath)\n\t}\n\n\tinfo, err := os.Lstat(fullPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"stat file %q: %w\", relPath, err)\n\t}\n\tif info.IsDir() {\n\t\treturn nil, fmt.Errorf(\"file path %q is a directory\", relPath)\n\t}\n\tif info.Mode()&os.ModeSymlink != 0 {\n\t\ttarget, err := os.Readlink(fullPath)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"read symlink %q: %w\", relPath, err)\n\t\t}\n\t\treturn []byte(target), nil\n\t}\n\n\tresolvedPath, err := filepath.EvalSymlinks(fullPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"resolve file %q: %w\", relPath, err)\n\t}\n\tif !pathutil.WithinBase(repoRoot, resolvedPath) {\n\t\treturn nil, fmt.Errorf(\"file path %q is outside repository\", relPath)","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/alibaba/open-code-review/blob/5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f/internal/diff/workspace_file.go#L20-L56","documentation":"os.Lstat on the joined path failed — the file reported as changed (e.g. untracked) no longer exists or cannot be stat'ed. Common when the working tree is modified between git listing the file and reading it, or on permission problems.","triggerScenarios":"Thrown at internal/diff/workspace_file.go:38 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error: ENOENT means the file was deleted between diff collection and read; EACCES means permission is missing","Refresh the file list (re-run git status) if the working tree changed concurrently","Ensure the process has read permission for the file"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cf97d0d15cbd41b602513c4be3bfec3cee5bf7f","analyzedAt":"2026-09-02T02:08:09.116Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}