{"record":{"id":"fd192c7b35d39aa5","repo":"coleam00/Archon","slug":"write-back-apply-failed-partway-landed-path-s","errorCode":null,"errorMessage":"Write-back apply failed partway (${landed} path(s) already applied to the live root — inspect and reconcile manually): ${detail}","messagePattern":"Write-back apply failed partway \\((.+?) path\\(s\\) already applied to the live root — inspect and reconcile manually\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"packages/isolation/src/container/overlay.ts","lineNumber":207,"sourceCode":"      '-v',\n      `${target.volume}:/upper:ro`,\n      '-v',\n      `${target.hostRoot}:/dest`,\n      target.image,\n      '-c',\n      buildApplyScript(),\n      'archon-overlay',\n      `/upper/${UPPER_DATA_SUBPATH}`,\n      '/dest',\n      target.hostRoot,\n    ]));\n  } catch (err) {\n    const detail = extractDockerError(err);\n    const partial = (err as { stdout?: string }).stdout ?? '';\n    const landed = parseRecords(partial).filter(\n      r => r.tag === 'W' || r.tag === 'K' || r.tag === 'D'\n    ).length;\n    throw new Error(\n      `Write-back apply failed partway (${landed} path(s) already applied to the live ` +\n        `root — inspect and reconcile manually): ${detail}`\n    );\n  }\n\n  let filesApplied = 0;\n  let filesDeleted = 0;\n  const warnings: string[] = [];\n  for (const { tag, fields } of parseRecords(stdout)) {\n    if (tag === 'W' || tag === 'K') filesApplied++;\n    else if (tag === 'D') filesDeleted++;\n    else if (tag === 'S') warnings.push(`skipped ${fields[0] ?? ''}: ${fields[1] ?? 'refused'}`);\n  }\n  // The helper also prints refusals/skips to stderr for the operator log.\n  if (stderr.trim()) warnings.push(...stderr.trim().split('\\n'));\n  log.info({ filesApplied, filesDeleted, volume: target.volume }, 'isolation.overlay_applied');\n  return { filesApplied, filesDeleted, warnings };\n}","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/isolation/src/container/overlay.ts#L189-L225","documentation":"applyOverlayChanges writes overlay-layer changes back to the live host root in one batched apply. If the apply command fails mid-way, the library parses partial machine-readable output to count how many paths (W/K/D records) already landed, then throws this error telling the operator the write-back is partially applied.","triggerScenarios":"The batched write-back command (tar/cp/rsync via docker) fails after some records were applied — e.g. disk full, permission denied on the host root, or the docker exec dies mid-stream.","commonSituations":"Host root owned by another user (permission denied partway through); ENOSPC on the host; container killed during apply; concurrent modification of the live root.","solutions":["Inspect the live root and reconcile the paths listed as already applied (count in the message)","Free disk space or fix host-root permissions, then re-run the apply","Take a backup of the live root before re-applying","Re-run applyOverlayChanges to apply the remaining paths"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// check space and permissions on the live root before apply\ndf -h <hostRoot>\ntest -w <hostRoot> && echo writable || echo 'host root not writable'","typeGuard":null,"tryCatchPattern":"try {\n  await backend.summary(envId, { apply: true });\n} catch (err) {\n  const m = String(err);\n  if (m.startsWith('Write-back apply failed partway')) {\n    const landed = /\\((\\d+) path/.exec(m)?.[1];\n    // reconcile the ${landed} already-applied paths manually before retrying\n  }\n  throw err;\n}","preventionTips":["Back up the live root before applying overlay changes","Ensure ample disk space and correct ownership on the host root","Do not kill the container or daemon mid-apply","Apply changes exclusively (avoid concurrent edits of the live root)"],"tags":["docker","overlayfs","partial-apply","data-integrity"],"backgroundTag":"overlay-writeback-partial-failure","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}