{"record":{"id":"3ef1004c7f6c3f8f","repo":"stablyai/orca","slug":"commit-failed","errorCode":null,"errorMessage":"Commit failed","messagePattern":"Commit failed","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mobile/src/source-control/use-mobile-git-requests.ts","lineNumber":45,"sourceCode":"        ...params\n      })\n      if (!response.ok) {\n        const error = new Error(\n          response.error?.message || 'Source control action failed'\n        ) as GitRequestError\n        error.code = response.error?.code\n        throw error\n      }\n      return (response as RpcSuccess).result as T\n    },\n    [client, connState, worktreeId]\n  )\n\n  const sendCommitRequest = useCallback(\n    async (message: string): Promise<GitCommitResult> => {\n      const result = await sendGitRequest<GitCommitResult>('git.commit', { message })\n      if (!result || result.success !== true) {\n        throw new Error(result?.error || 'Commit failed')\n      }\n      return result\n    },\n    [sendGitRequest]\n  )\n\n  const readUpstreamStatusForSync = useCallback(async (): Promise<MobileGitUpstreamStatus> => {\n    try {\n      return await sendGitRequest<MobileGitUpstreamStatus>('git.upstreamStatus')\n    } catch (err) {\n      const code = err instanceof Error ? (err as GitRequestError).code : undefined\n      const message = err instanceof Error ? err.message : String(err)\n      if (!isMobileGitUnavailable(code, message)) {\n        throw err\n      }\n      const status = await sendGitRequest<MobileGitStatusResult>('git.status')\n      if (!status.upstreamStatus) {\n        throw new Error('Branch status unavailable')","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/mobile/src/source-control/use-mobile-git-requests.ts#L27-L63","documentation":"Thrown by `sendCommitRequest` after the `git.commit` RPC returns ok:true but the application-level result is not a success — either the result is nullish or `result.success !== true`. The host signals a logical commit failure (as opposed to a transport failure) and optionally provides `result.error`; this code surfaces that detail or the literal 'Commit failed'.","triggerScenarios":"Calling `sendCommitRequest(message)` where `git.commit` resolves with `{ success: false, error }` or an empty result. Typical host-side reasons: nothing staged to commit, a pre-commit hook exited non-zero, a lock file (.git/index.lock) is held, or the commit was rejected by a server-side rule.","commonSituations":"User taps Commit with nothing staged; a husky/pre-commit hook fails; another git process holds the index lock; commit-message validation rejects the input.","solutions":["Inspect `result.error` (surfaced as the message) for the exact host reason.","Stage at least one change before committing.","Resolve a failing pre-commit hook or bypass it if intentional.","Remove a stale `.git/index.lock` if no git process is running."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate commit preconditions before sending.\nif (countStagedEntries(entries) === 0) {\n  setActionError('Nothing staged to commit.')\n  return\n}","typeGuard":"function isCommitSuccess(result: unknown): result is GitCommitResult {\n  return !!result && (result as GitCommitResult).success === true\n}","tryCatchPattern":"try {\n  const result = await sendCommitRequest(message)\n} catch (err) {\n  // result.success === false carries a host reason; surface it, don't retry blindly\n  setActionError(err instanceof Error ? err.message : 'Commit failed')\n}","preventionTips":["Ensure something is staged before offering Commit.","Surfacing result.error tells the user which hook/rule blocked the commit.","Don't retry on hook failures — fix the hook or the input."],"tags":["source-control","git","commit","hooks"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}