{"record":{"id":"6a2f544786179b56","repo":"coleam00/Archon","slug":"project-projectname-could-not-be-updated-da","errorCode":null,"errorMessage":"Project \"${projectName}\" could not be updated — database error. Please try again.","messagePattern":"Project \"(.+?)\" could not be updated — database error\\. Please try again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/orchestrator/orchestrator-agent.ts","lineNumber":3464,"sourceCode":"  // Find existing codebase by name\n  const existing = await codebaseDb.listCodebases();\n  const codebase = existing.find(c => c.name.toLowerCase() === projectName.toLowerCase());\n\n  if (!codebase) {\n    return `Project \"${projectName}\" not found. Use /register-project to create it.`;\n  }\n\n  try {\n    await codebaseDb.updateCodebase(codebase.id, { default_cwd: newPath });\n  } catch (err) {\n    getLog().warn({ err: err as Error, codebaseId: codebase.id, newPath }, 'project.update_failed');\n    // Row gone (deleted between the fetch above and the UPDATE) is the only\n    // case where \"removed\" is the honest answer; anything else is an\n    // operational DB failure and should say so instead of blaming data state.\n    if (err instanceof codebaseDb.CodebaseNotFoundError) {\n      return `Project \"${projectName}\" could not be updated — it appears to have been removed. Use /register-project to re-create it.`;\n    }\n    return `Project \"${projectName}\" could not be updated — database error. Please try again.`;\n  }\n  getLog().info(\n    { name: projectName, oldPath: codebase.default_cwd, newPath, id: codebase.id },\n    'project.update_completed'\n  );\n  return `Project \"${projectName}\" updated.\\nOld path: ${codebase.default_cwd}\\nNew path: ${newPath}`;\n}\n\n/**\n * Handle /remove-project command.\n * Deletes a registered project from the database.\n */\nasync function handleRemoveProject(message: string): Promise<string> {\n  const { args } = commandHandler.parseCommand(message);\n  if (args.length < 1) {\n    return 'Usage: /remove-project <name>';\n  }\n","sourceCodeStart":3446,"sourceCodeEnd":3482,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/core/src/orchestrator/orchestrator-agent.ts#L3446-L3482","documentation":"The fallback message when a project path update fails for any reason other than the row being missing — i.e. an operational database error (connection failure, constraint violation, timeout) during the UPDATE in the orchestrator agent. It is intentionally distinct from the 'removed' message so operational DB problems are not misreported as data-state problems.","triggerScenarios":"The UPDATE of the codebase's default_cwd throws any error that is not CodebaseNotFoundError: database unreachable, connection pool exhausted, SQLite lock contention, schema/constraint failure, or transient network partition to PostgreSQL.","commonSituations":"Database server restarted or unreachable mid-command; another process holding a write lock on the codebases table; disk full on the database host; running against a stale schema missing a newly added column.","solutions":["Retry the update as the message suggests — transient DB failures often resolve on retry.","Check the structured log event project.update_failed (with the error object) for the actual DB error.","Verify database connectivity and health (is the server up? connection limits? locks?).","If schema-related, run pending migrations/checks, then retry."],"exampleFix":"// before\npg_isready -h localhost -p 5432   # no response\n// after\nsystemctl start postgresql   # or restore connectivity\n/update-project myapp /new/path","handlingStrategy":"retry","validationCode":"import { execSync } from 'node:child_process';\n// cheap health probe before issuing the update:\ntry { execSync('pg_isready', { stdio: 'pipe' }); } catch { throw new Error('Database unreachable; fix connectivity before updating the project'); }","typeGuard":null,"tryCatchPattern":"let lastErr: unknown;\nfor (let attempt = 0; attempt < 3; attempt++) {\n  try { await updateProjectPath(id, newPath); return; }\n  catch (err) {\n    if (err instanceof codebaseDb.CodebaseNotFoundError) throw err;\n    lastErr = err;\n    await sleep(2 ** attempt * 250);\n  }\n}\nthrow lastErr;","preventionTips":["Verify database health (pg_isready, connection limits) before project mutations.","Keep retry-with-backoff around transient DB operations.","Monitor project.update_failed log events for recurring DB errors.","Keep schema migrations current on the database the instance points at."],"tags":["database","project","transient"],"backgroundTag":"database-operation-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}