{"record":{"id":"18fdff932aca4e24","repo":"pulumi/pulumi","slug":"source-positions-must-include-absolute-paths","errorCode":null,"errorMessage":"source positions must include absolute paths","messagePattern":"source positions must include absolute paths","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resource/deploy/source_eval.go","lineNumber":2088,"sourceCode":"\tcol := \"\"\n\tif raw.Column != 0 {\n\t\tif raw.Column < 0 {\n\t\t\treturn \"\", fmt.Errorf(\"invalid column number %v\", raw.Column)\n\t\t}\n\t\tcol = \",\" + strconv.FormatInt(int64(raw.Column), 10)\n\t}\n\n\tposURL, err := url.Parse(raw.Uri)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif posURL.Scheme != \"file\" {\n\t\treturn \"\", fmt.Errorf(\"unrecognized scheme %q\", posURL.Scheme)\n\t}\n\n\tfile := filepath.FromSlash(posURL.Path)\n\tif !filepath.IsAbs(file) {\n\t\treturn \"\", errors.New(\"source positions must include absolute paths\")\n\t}\n\trel, err := filepath.Rel(s.projectRoot, file)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"making relative path: %w\", err)\n\t}\n\n\tposURL.Scheme = \"project\"\n\tposURL.Path = \"/\" + filepath.ToSlash(rel)\n\tposURL.Fragment = fmt.Sprintf(\"%v%s\", raw.Line, col)\n\n\treturn posURL.String(), nil\n}\n\nfunc (s *sourcePositions) newStackTrace(raw *pulumirpc.StackTrace) stackTrace {\n\tif raw == nil {\n\t\treturn nil\n\t}\n","sourceCodeStart":2070,"sourceCodeEnd":2106,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/resource/deploy/source_eval.go#L2070-L2106","documentation":"After confirming the file scheme, the engine converts the position path to an OS path and requires it to be absolute so it can be made relative to the project root. A relative path would make the resulting project:// URI ambiguous, so the engine rejects it.","triggerScenarios":"A source position URI like file://main.ts or file://../lib/x.ts (relative path component) reaches the position translation in source_eval.go.","commonSituations":"Language host emits positions relative to the working directory instead of absolute; symlinked or sandboxed execution where paths are computed relative; custom providers emitting compact positions.","solutions":["Ensure the language host/program reports absolute source file paths","Run the program from a correct working directory so tools resolve absolute paths","Check the position-producing tool/SDK version for relative-path bugs and upgrade"],"exampleFix":"// before\n\"file://src/index.ts#5\"\n// after\n\"file:///home/user/project/src/index.ts#5\"","handlingStrategy":"validation","validationCode":"p := filepath.FromSlash(u.Path)\nif !filepath.IsAbs(p) {\n    p, _ = filepath.Abs(p)\n    u.Path = filepath.ToSlash(p)\n}","typeGuard":"func isAbsPosition(u *url.URL) bool { return filepath.IsAbs(filepath.FromSlash(u.Path)) }","tryCatchPattern":null,"preventionTips":["Configure tools/hosts to report absolute paths","Run programs with a stable working directory"],"tags":["go","pulumi-engine","source-positions","paths"],"backgroundTag":"relative-source-path","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}