windmill-labs/windmill · error · Error
No commit hash available
Error message
No commit hash available
What it means
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.
Source
Thrown at frontend/src/lib/components/GitRepoResourcePicker.svelte:141
try {
// Get commit hash if not provided
let commitHash = currentCommit
if (!commitHash) {
try {
const result = await ResourceService.getGitCommitHash({
workspace: ws!,
path: selectedResource,
gitSshIdentity: gitSshIdentity?.join(',')
})
commitHash = result.commit_hash
} catch (err) {
console.error('Failed to get commit hash:', err)
throw new Error('Could not get commit hash for repository')
}
}
if (!commitHash) {
throw new Error('No commit hash available')
}
const inventoryFiles = await getInventoryFiles(
selectedResource,
inventoriesLocation.trim(),
commitHash
)
// Dispatch event to update the script with additional_inventories
dispatch('addInventories', {
inventoryPaths: inventoryFiles
})
// TODO: Add success feedback
} catch (error) {
console.error('Failed to load inventory files:', error)
// TODO: Add error feedback
} finally {View on GitHub (pinned to e474e8803c)
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)
Defensive patterns
Strategy: validation
Validate before calling
const result = await addInventories(args);
commitHash = result.commit_hash;
if (!commitHash) throw new Error('Backend returned no commit_hash for ' + selectedResource); Type guard
function hasCommitHash(r: unknown): r is { commit_hash: string } {
return !!r && typeof r === 'object' && typeof (r as any).commit_hash === 'string' && (r as any).commit_hash.length > 0;
} Try / catch
if (!commitHash) {
console.error('No commit hash in response — check backend version or repo state');
sendUserToast('Repository returned no commit hash', true);
return;
} Prevention
- 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
When it happens
Trigger: The backend call succeeds but returns a response without commit_hash (or empty), so commitHash stays undefined before getInventoryFiles runs.
Common situations: Backend/API version mismatch where commit_hash was renamed or omitted; empty repository; backend bug swallowing the hash for certain repo types.
Related errors
- Failed to re-run job ${id}.
- Failed to push completed jobs: ${e}
- GET ${path} -> ${resp.status}
- You can only create forks within a git repo. Forks are track
- Could not get git branch name
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/20f339c2f8592d7d.
Report an issue: GitHub.