refined-github/refined-github · warning · Error
The file was renamed and Refined GitHub can’t find it
Error message
The file was renamed and Refined GitHub can’t find it
What it means
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.
Source
Thrown at source/features/deep-reblame.tsx:35
import GetPullRequestBlameCommit from './deep-reblame.gql';
const getPullRequestBlameCommit = mem(
async (commit: string, prNumbers: number[], currentFilename: string): Promise<string> => {
const {repository} = await api.v4(GetPullRequestBlameCommit, {
variables: {
commit,
file: commit + ':' + currentFilename,
},
});
const associatedPr = repository.object.associatedPullRequests.nodes[0];
if (!associatedPr || !prNumbers.includes(associatedPr.number) || associatedPr.mergeCommit.oid !== commit) {
throw new Error('The PR linked in the title didn’t create this commit');
}
if (!repository.file) {
throw new Error('The file was renamed and Refined GitHub can’t find it');
}
return associatedPr.commits.nodes[0].commit.oid;
},
);
function extractCommitFromHoverCardUrl(url: string): string {
return /[/]commit[/](?<commit>[0-9a-f]{40})[/]/i.exec(url)!.groups!.commit;
}
async function redirectToBlameCommit(
event: DelegateEvent<MouseEvent, HTMLAnchorElement | HTMLButtonElement>,
): Promise<void> {
const blameElement = event.delegateTarget;
if (blameElement instanceof HTMLAnchorElement && !event.altKey) {
return; // Unmodified click on regular link: let it proceed
}
View on GitHub (pinned to 73afd11264)
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
Defensive patterns
Strategy: validation
Validate before calling
const file = data.repository.file ?? data.repository.history?.nodes[0]; if (!file) return;
Type guard
function hasFile(data: unknown): data is {repository: {file: object}} {
return !!(data as any)?.repository?.file;
} Prevention
- Null-check every nullable GraphQL field before use
- Detect renames up front via history/path expressions and fall back to the old path
When it happens
Trigger: 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.
Common situations: Files moved or renamed in PRs, path casing changes, or the GraphQL file(pathExpression:) lookup failing after GitHub API changes.
Related errors
- The PR linked in the title didn’t create this commit
- details.message
- The token you provided does not have ' + (tokenScopes.length
- Unable to find the PR metadata text node
- Expected the cell to have the `data-line-number` attribute
AI-assisted analysis of refined-github/refined-github@73afd11264 (2026-08-27).
Data as JSON: /api/errors/277a70a220257f0e.
Report an issue: GitHub.