{"record":{"id":"2fcbaad18ec92637","repo":"windmill-labs/windmill","slug":"could-not-get-commit-hash-for-repository","errorCode":null,"errorMessage":"Could not get commit hash for repository","messagePattern":"Could not get commit hash for repository","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/GitRepoResourcePicker.svelte","lineNumber":136,"sourceCode":"\t}\n\tasync function handleAddInventories() {\n\t\tif (!selectedResource || !inventoriesLocation.trim()) return\n\n\t\tloadingInventories = true\n\t\ttry {\n\t\t\t// Get commit hash if not provided\n\t\t\tlet commitHash = currentCommit\n\t\t\tif (!commitHash) {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await ResourceService.getGitCommitHash({\n\t\t\t\t\t\tworkspace: ws!,\n\t\t\t\t\t\tpath: selectedResource,\n\t\t\t\t\t\tgitSshIdentity: gitSshIdentity?.join(',')\n\t\t\t\t\t})\n\t\t\t\t\tcommitHash = result.commit_hash\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error('Failed to get commit hash:', err)\n\t\t\t\t\tthrow new Error('Could not get commit hash for repository')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!commitHash) {\n\t\t\t\tthrow new Error('No commit hash available')\n\t\t\t}\n\n\t\t\tconst inventoryFiles = await getInventoryFiles(\n\t\t\t\tselectedResource,\n\t\t\t\tinventoriesLocation.trim(),\n\t\t\t\tcommitHash\n\t\t\t)\n\n\t\t\t// Dispatch event to update the script with additional_inventories\n\t\t\tdispatch('addInventories', {\n\t\t\t\tinventoryPaths: inventoryFiles\n\t\t\t})\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/GitRepoResourcePicker.svelte#L118-L154","documentation":"In frontend/src/lib/components/GitRepoResourcePicker.svelte:136, handleAddInventories calls a git-sync endpoint that returns a commit_hash; on failure it logs the original error and throws \"Could not get commit hash for repository\". It means the backend could not clone/fetch the repo (or resolve a commit) for the given resource/SSH identity.","triggerScenarios":"The underlying request threw — bad repo URL, invalid or insufficiently-scoped SSH identity, unreachable git host, or repo/resource misconfigured — so result.commit_hash was never set.","commonSituations":"SSH key lacks access to the repo; wrong gitSshIdentity resource selected; firewall blocking the git host; repository path typo in the resource.","solutions":["Check browser console for the logged 'Failed to get commit hash' cause","Verify the git SSH identity resource has access to the repository","Test repo reachability/clone manually with the same credentials","Confirm the repo URL and default branch in the resource config"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!selectedResource) throw new Error('Select a git repository resource first');\nif (needsIdentity && !gitSshIdentity?.length) throw new Error('Select an SSH identity with repo access');","typeGuard":"null","tryCatchPattern":"try {\n  const result = await addInventories({ path: selectedResource, gitSshIdentity: gitSshIdentity?.join(',') });\n  commitHash = result.commit_hash;\n} catch (err) {\n  console.error('Failed to get commit hash:', err); // original cause preserved\n  sendUserToast('Could not reach repository: ' + (err.body?.message ?? err.message), true);\n}","preventionTips":["Verify the SSH identity resource can clone the repo before wiring inventories","Check the console log — the underlying cause is logged before this error","Test repo connectivity/credentials from the same network as the server"],"tags":["git","ssh","network"],"backgroundTag":"git-clone-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}