{"record":{"id":"7356583d12418a3b","repo":"microsoft/typescript-go","slug":"w-node-handle-q-could-not-be-resolved-file-may","errorCode":null,"errorMessage":"%w: node handle %q could not be resolved (file may not be loaded or handle may be stale)","messagePattern":"%w: node handle %q could not be resolved \\(file may not be loaded or handle may be stale\\)","errorType":"validation","errorClass":"ErrClientError","httpStatus":null,"severity":"error","filePath":"internal/api/session.go","lineNumber":3293,"sourceCode":"\tfirstDot := strings.IndexByte(s, '.')\n\tif firstDot == -1 {\n\t\treturn nil, fmt.Errorf(\"%w: invalid node handle %q\", ErrClientError, handle)\n\t}\n\tsecondDot := strings.IndexByte(s[firstDot+1:], '.')\n\tif secondDot == -1 {\n\t\treturn nil, fmt.Errorf(\"%w: invalid node handle %q\", ErrClientError, handle)\n\t}\n\tsecondDot += firstDot + 1 // adjust to absolute index\n\n\tidx, err := strconv.ParseUint(s[:firstDot], 10, 32)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%w: invalid node handle %q: %w\", ErrClientError, handle, err)\n\t}\n\tpath := tspath.Path(s[secondDot+1:])\n\n\tsourceFile := program.GetSourceFileByPath(path)\n\tif sourceFile == nil {\n\t\treturn nil, fmt.Errorf(\"%w: node handle %q could not be resolved (file may not be loaded or handle may be stale)\", ErrClientError, handle)\n\t}\n\ttable := encoder.GetNodeIndexTable(sourceFile)\n\n\tif table != nil && idx < uint64(len(table.Nodes)) {\n\t\tnode := table.Nodes[idx]\n\t\tif node != nil {\n\t\t\treturn node, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"%w: node handle %q could not be resolved (file may not be loaded or handle may be stale)\", ErrClientError, handle)\n}\n\n// computeSnapshotChanges computes the per-project source file differences between\n// two snapshots. It uses DiffOrderedMaps on projects to find changed/removed projects,\n// then DiffMaps on FilesByPath for each changed project to collect file-level changes.\nfunc computeSnapshotChanges(prev *project.Snapshot, next *project.Snapshot) *SnapshotChanges {\n\tprevProjects := prev.ProjectCollection.ProjectsByPath()\n\tnextProjects := next.ProjectCollection.ProjectsByPath()","sourceCodeStart":3275,"sourceCodeEnd":3311,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/internal/api/session.go#L3275-L3311","documentation":"Error \"%w: node handle %q could not be resolved (file may not be loaded or handle may be stale)\" thrown in microsoft/typescript-go.","triggerScenarios":"Thrown at internal/api/session.go:3293 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}