stablyai/orca · error · Error

${label} must be a full git object id

Error message

${label} must be a full git object id

What it means

Thrown by validateFullGitObjectId when a value does not match FULL_GIT_OBJECT_ID_PATTERN (a full 40-char SHA-1 or 64-char SHA-256 hex string). Used at several IPC call sites (commitId, commitOid, parentOid, sha) to reject abbreviated SHAs, short refs, or malformed input before passing them to Git commands that require full object IDs.

Source

Thrown at src/main/ipc/filesystem.ts:461

  }
}

function getLocalTextGenerationTarget(
  worktreePath: string,
  gitOptions: LocalProjectWorktreeGitOptions,
  env?: NodeJS.ProcessEnv
): Extract<CommitMessageGenerationTarget, { kind: 'local' }> {
  return {
    kind: 'local',
    cwd: worktreePath,
    ...(gitOptions.wslDistro ? { wslDistro: gitOptions.wslDistro } : {}),
    ...(env ? { env } : {})
  }
}

function validateFullGitObjectId(value: string, label: string): string {
  if (!FULL_GIT_OBJECT_ID_PATTERN.test(value)) {
    throw new Error(`${label} must be a full git object id`)
  }
  return value
}

/**
 * Check if a buffer appears to be binary (contains null bytes in first 8KB).
 */
function isBinaryBuffer(buffer: Buffer): boolean {
  const len = Math.min(buffer.length, 8192)
  for (let i = 0; i < len; i++) {
    if (buffer[i] === 0) {
      return true
    }
  }
  return false
}

async function isBinaryFilePrefix(filePath: string): Promise<boolean> {

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Resolve the ref to a full SHA before calling the IPC: run `git rev-parse <ref>` and pass the result.
  2. If the renderer has an abbreviated SHA, resolve it server-side first using `git rev-parse <short-sha>`.
  3. Validate the SHA format in the renderer with the same regex before calling the IPC.

Example fix

// before:
//   ipcRenderer.invoke('fs:getCommitDiff', { commitId: 'abc1234' })
// after:
//   const fullSha = await gitRevParse(worktree, 'abc1234')
//   ipcRenderer.invoke('fs:getCommitDiff', { commitId: fullSha })
//
// or validate client-side:
//   if (!/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(sha)) throw new Error('Full SHA required')
Defensive patterns

Strategy: type-guard

Validate before calling

const FULL_GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/

function assertFullGitObjectId(value: string, label: string): void {
  if (!FULL_GIT_OBJECT_ID_PATTERN.test(value)) {
    throw new Error(`${label} must be a full 40 or 64 character hex git object id, got: ${value}`)
  }
}

// Before calling IPC:
// assertFullGitObjectId(commitSha, 'commitId')
// ipcRenderer.invoke('fs:getCommitDiff', { commitId: commitSha })

Type guard

const FULL_GIT_OBJECT_ID_PATTERN = /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/

function isFullGitObjectId(value: unknown): value is string {
  return typeof value === 'string' && FULL_GIT_OBJECT_ID_PATTERN.test(value)
}

// Usage:
// if (!isFullGitObjectId(commitSha)) {
//   const resolved = await gitRevParse(worktree, commitSha)
//   commitSha = resolved
// }

Try / catch

try {
  await ipcRenderer.invoke('fs:getCommitDiff', { commitId })
} catch (error) {
  if (error instanceof Error && error.message.includes('must be a full git object id')) {
    // resolve the abbreviated ref to a full SHA and retry
    const fullSha = await resolveFullSha(worktree, commitId)
    return ipcRenderer.invoke('fs:getCommitDiff', { commitId: fullSha })
  }
  throw error
}

Prevention

When it happens

Trigger: Passing a 7-character abbreviated SHA, a branch name, a tag name, or a malformed hex string to an IPC handler that calls validateFullGitObjectId. The regex /^(?:[0-9a-fA-F]{40}|[0-9a-fA-F]{64})$/ requires exactly 40 or 64 lowercase/uppercase hex characters.

Common situations: Renderer code passes a shortened commit hash from a UI list that abbreviated it. Passing a ref name (HEAD, main, refs/heads/feature) instead of a resolved SHA. Copy-paste errors that truncate or add whitespace to a SHA. Non-hex characters in a user-entered commit ID field.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/d2aaf18b2ea32ff3. Report an issue: GitHub.