{"record":{"id":"277a70a220257f0e","repo":"refined-github/refined-github","slug":"the-file-was-renamed-and-refined-github-can-t-find","errorCode":null,"errorMessage":"The file was renamed and Refined GitHub can’t find it","messagePattern":"The file was renamed and Refined GitHub can’t find it","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"source/features/deep-reblame.tsx","lineNumber":35,"sourceCode":"import GetPullRequestBlameCommit from './deep-reblame.gql';\n\nconst getPullRequestBlameCommit = mem(\n\tasync (commit: string, prNumbers: number[], currentFilename: string): Promise<string> => {\n\t\tconst {repository} = await api.v4(GetPullRequestBlameCommit, {\n\t\t\tvariables: {\n\t\t\t\tcommit,\n\t\t\t\tfile: commit + ':' + currentFilename,\n\t\t\t},\n\t\t});\n\n\t\tconst associatedPr = repository.object.associatedPullRequests.nodes[0];\n\n\t\tif (!associatedPr || !prNumbers.includes(associatedPr.number) || associatedPr.mergeCommit.oid !== commit) {\n\t\t\tthrow new Error('The PR linked in the title didn’t create this commit');\n\t\t}\n\n\t\tif (!repository.file) {\n\t\t\tthrow new Error('The file was renamed and Refined GitHub can’t find it');\n\t\t}\n\n\t\treturn associatedPr.commits.nodes[0].commit.oid;\n\t},\n);\n\nfunction extractCommitFromHoverCardUrl(url: string): string {\n\treturn /[/]commit[/](?<commit>[0-9a-f]{40})[/]/i.exec(url)!.groups!.commit;\n}\n\nasync function redirectToBlameCommit(\n\tevent: DelegateEvent<MouseEvent, HTMLAnchorElement | HTMLButtonElement>,\n): Promise<void> {\n\tconst blameElement = event.delegateTarget;\n\tif (blameElement instanceof HTMLAnchorElement && !event.altKey) {\n\t\treturn; // Unmodified click on regular link: let it proceed\n\t}\n","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/refined-github/refined-github/blob/73afd11264c0243e077d20d07e5bc048feb2ba7b/source/features/deep-reblame.tsx#L17-L53","documentation":"Thrown by deep-reblame when the GraphQL query for the file (by blob path and commit oid) returns repository.file = null. That happens when the path of the file being blamed does not exist at that commit — classically because the file was renamed between the PR head and the merge commit, so the blame-prior-to-PR lookup cannot find the blob.","triggerScenarios":"Using 'Deep re-blame' on a file that was renamed/moved in the PR (path at the merge commit differs from the current path), or when the queried commit oid is wrong; GitHub returns no object.file for the given path expression.","commonSituations":"Files moved or renamed in PRs, path casing changes, or the GraphQL file(pathExpression:) lookup failing after GitHub API changes.","solutions":["Confirm the file path in the URL actually exists at the target commit (e.g. browse the commit on github.com); if renamed, manually blame the old path","If GitHub's file lookup changed, update the GraphQL query in deep-reblame.tsx (e.g. query by history expressions) and the null check","Update refined-github to the latest version where the query may have been fixed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const file = data.repository.file ?? data.repository.history?.nodes[0];\nif (!file) return;","typeGuard":"function hasFile(data: unknown): data is {repository: {file: object}} {\n\treturn !!(data as any)?.repository?.file;\n}","tryCatchPattern":null,"preventionTips":["Null-check every nullable GraphQL field before use","Detect renames up front via history/path expressions and fall back to the old path"],"tags":["graphql","github-api","renamed-file","blame","refined-github"],"backgroundTag":"graphql-null-field","analyzedSha":"73afd11264c0243e077d20d07e5bc048feb2ba7b","analyzedAt":"2026-08-27T22:35:47.934Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}