{"record":{"id":"3a12300c5505d568","repo":"anomalyco/sst","slug":"failed-to-get-absolute-path-for-s-w","errorCode":null,"errorMessage":"failed to get absolute path for %s: %w","messagePattern":"failed to get absolute path for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/project.go","lineNumber":91,"sourceCode":"\t\tProjectRoot:   projectRoot,\n\t\tPyprojectPath: pyprojectPath,\n\t}\n\n\tinfo.SourceRoot = resolveSourceRoot(projectRoot, pyprojectPath)\n\n\treturn info, nil\n}\n\n// findPythonFile locates the Python file for the given handler path.\nfunc findPythonFile(projectRoot, handlerPath string) (string, error) {\n\tfilePath := extractFilePath(handlerPath)\n\tcandidates := generateCandidatePaths(projectRoot, filePath)\n\n\tfor _, candidate := range candidates {\n\t\tif info, err := os.Stat(candidate); err == nil && info.Mode().IsRegular() && strings.HasSuffix(candidate, \".py\") {\n\t\t\tabsPath, err := filepath.Abs(candidate)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"failed to get absolute path for %s: %w\", candidate, err)\n\t\t\t}\n\t\t\treturn absPath, nil\n\t\t}\n\t}\n\n\treturn \"\", fmt.Errorf(\"handler not found: %s (searched %d candidate paths)\", handlerPath, len(candidates))\n}\n\n// extractFilePath extracts the file path from a handler path.\nfunc extractFilePath(handlerPath string) string {\n\tif lastDot := strings.LastIndex(handlerPath, \".\"); lastDot != -1 {\n\t\treturn handlerPath[:lastDot]\n\t}\n\treturn handlerPath\n}\n\n// generateCandidatePaths creates a list of potential file locations.\nfunc generateCandidatePaths(projectRoot, handlerPath string) []string {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/project.go#L73-L109","documentation":"findPythonFile found a matching candidate .py file via os.Stat, but converting the relative candidate path to an absolute path with filepath.Abs failed. This is a rare wrapper around OS-level path resolution errors (e.g. permission issues on a path component or an excessively long path). The %w preserves the original os error.","triggerScenarios":"os.Stat succeeded for a candidate like <root>/src/handler.py but filepath.Abs returned an error — practically only when the process working directory is unreadable, or on filesystems with pathological path lengths/permissions.","commonSituations":"Running the CLI from a deleted or permission-restricted working directory; deploying inside a container with a broken mount point for the project root; extremely deep monorepo paths exceeding OS path limits.","solutions":["Check filesystem permissions and that the current working directory exists and is accessible.","Inspect the wrapped %w error for the exact OS reason and fix the underlying path/mount issue.","Shorten or normalize the project path if it is near the OS path-length limit.","Re-run from a normal, existing directory (e.g. the repo root)."],"exampleFix":"// before (deleted cwd)\n$ rm -rf old-dir && sst deploy  # failed to get absolute path ...\n\n// after\n$ cd /path/to/project && sst deploy","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await deploy() } catch (e) {\n  if (String(e).includes(\"failed to get absolute path for\"))\n    console.error(\"Check cwd/mount/permissions:\", String(e));\n  throw e;\n}","preventionTips":["Run deploy commands from an existing, accessible working directory.","Avoid deploying inside containers with broken or read-only mounts.","Keep project paths below OS path-length limits."],"tags":["python","filesystem","path-resolution"],"backgroundTag":"absolute-path-resolution-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}