{"record":{"id":"20f339c2f8592d7d","repo":"windmill-labs/windmill","slug":"no-commit-hash-available","errorCode":null,"errorMessage":"No commit hash available","messagePattern":"No commit hash available","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/GitRepoResourcePicker.svelte","lineNumber":141,"sourceCode":"\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\n\t\t\t// TODO: Add success feedback\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to load inventory files:', error)\n\t\t\t// TODO: Add error feedback\n\t\t} finally {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/GitRepoResourcePicker.svelte#L123-L159","documentation":"In frontend/src/lib/components/GitRepoResourcePicker.svelte:141, after the add-inventories call, handleAddInventories checks commitHash and throws \"No commit hash available\" if it is still falsy (e.g. the API returned no commit_hash field). Downstream getInventoryFiles needs that hash to read files at a fixed ref.","triggerScenarios":"The backend call succeeds but returns a response without commit_hash (or empty), so commitHash stays undefined before getInventoryFiles runs.","commonSituations":"Backend/API version mismatch where commit_hash was renamed or omitted; empty repository; backend bug swallowing the hash for certain repo types.","solutions":["Log/inspect the API response to see if commit_hash is present","Update frontend/backend to matching versions","Verify the repository is non-empty and has a resolvable HEAD","Retry after confirming the repo works elsewhere (e.g. wmill CLI git sync)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const result = await addInventories(args);\ncommitHash = result.commit_hash;\nif (!commitHash) throw new Error('Backend returned no commit_hash for ' + selectedResource);","typeGuard":"function hasCommitHash(r: unknown): r is { commit_hash: string } {\n  return !!r && typeof r === 'object' && typeof (r as any).commit_hash === 'string' && (r as any).commit_hash.length > 0;\n}","tryCatchPattern":"if (!commitHash) {\n  console.error('No commit hash in response — check backend version or repo state');\n  sendUserToast('Repository returned no commit hash', true);\n  return;\n}","preventionTips":["Assert the response shape right after the API call","Keep frontend and backend versions aligned (commit_hash field contract)","Ensure the repository is non-empty with a resolvable HEAD"],"tags":["git","api","null-value"],"backgroundTag":"api-response-missing-field","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"}