{"record":{"id":"3ba63a8d98752a5a","repo":"coleam00/Archon","slug":"persist-session-upsert-failed","errorCode":"persist_session_upsert_failed","errorMessage":"⚠️ Could not persist the session for node `${node.id}` (${provider}). The next run will start this node fresh.","messagePattern":"⚠️ Could not persist the session for node `(.+?)` \\((.+?)\\)\\. The next run will start this node fresh\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/workflows/src/dag-executor.ts","lineNumber":10689,"sourceCode":"                    last_run_id: ctx.workflowRun.id,\n                  });\n                } else {\n                  // Provider returned no session ID (e.g. Codex with no thread ID).\n                  // Drop the stale row for THIS provider only — leave other providers'\n                  // rows intact so switching providers between runs doesn't clobber\n                  // the other side's continuity.\n                  await ctx.deps.store.deleteWorkflowNodeSessions({\n                    workflow_name: ctx.workflowName,\n                    scope_key: ctx.persistScopeKey,\n                    node_id: node.id,\n                    provider,\n                  });\n                }\n              } catch (err) {\n                // Non-fatal: persistence failure does not undo a successful node execution.\n                // But the user opted into persistence — the next run will start fresh for\n                // this node, so warn them as well as the logs.\n                getLog().warn(\n                  {\n                    err: err as Error,\n                    nodeId: node.id,\n                    workflow: ctx.workflowName,\n                    scopeKey: ctx.persistScopeKey,\n                    provider,\n                  },\n                  'persist_session_upsert_failed'\n                );\n                await safeSendMessage(\n                  ctx.platform,\n                  ctx.conversationId,\n                  `⚠️ Could not persist the session for node \\`${node.id}\\` (${provider}). The next run will start this node fresh.`,\n                  { workflowId: ctx.workflowRun.id, nodeName: node.id }\n                );\n              }\n            }\n","sourceCodeStart":10671,"sourceCodeEnd":10707,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/workflows/src/dag-executor.ts#L10671-L10707","documentation":"Non-fatal warning: writing the node's session to the persistence store (upsert) threw after the node already ran successfully. The execution result stands, but the next run will start this node fresh because nothing was persisted.","triggerScenarios":"Catch branch around the session upsert for (workflow, node, persistScopeKey, provider); DB write failures, constraint violations, storage full, connection drops.","commonSituations":"Database briefly unavailable at node completion; schema/adapter mismatch after upgrade; disk pressure on the SQLite/Postgres host.","solutions":["Check server logs for the underlying `err` on this event","Verify database health and available disk space","Re-run the workflow (or the node) so the session is persisted again","If it recurs, inspect the sessions table constraints and adapter version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Confirm the session store accepts writes before the run\nawait store.upsertTestRow();","typeGuard":null,"tryCatchPattern":"try {\n  await runNode(node);\n} catch (err) {\n  if (isPersistUpsertFailed(err)) {\n    await retry(() => persistSession(node), { retries: 3, backoff: 'exponential' });\n  } else throw err;\n}","preventionTips":["Monitor DB write health and disk space","Re-run the workflow after fixing DB issues so sessions are re-persisted","Verify adapter/schema alignment after upgrades"],"tags":["database","session","persistence"],"backgroundTag":"session-persist-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}