{"record":{"id":"effb6c37a246cf01","repo":"Yeachan-Heo/oh-my-codex","slug":"cleanuperrors-join","errorCode":null,"errorMessage":"cleanupErrors.join(' | ')","messagePattern":"cleanupErrors\\.join\\(' \\| '\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/team/runtime.ts","lineNumber":5612,"sourceCode":"    } catch (err) {\n      cleanupErrors.push(`rollbackProvisionedWorktrees: ${String(err)}`);\n    }\n  }\n\n  // 7. Cleanup state\n  let teamStateCleaned = false;\n  try {\n    await cleanupTeamState(sanitized, cwd);\n    teamStateCleaned = true;\n  } catch (err) {\n    cleanupErrors.push(`cleanupTeamState: ${String(err)}`);\n  }\n  if (teamStateCleaned) {\n    await syncTeamModeStateOnShutdown(sanitized, cwd, leaderSessionId);\n  }\n\n  if (cleanupErrors.length > 0) {\n    throw new Error(cleanupErrors.join(' | '));\n  }\n\n  return { commitHygieneArtifacts }\n}\n\n/**\n * Resume monitoring an existing team.\n */\nexport async function resumeTeam(teamName: string, cwd: string): Promise<TeamRuntime | null> {\n  const sanitized = resolveTeamNameForCurrentContext(teamName, cwd);\n  const config = await readTeamConfig(sanitized, cwd);\n  if (!config) return null;\n  config.lifecycle_profile = 'default';\n  const leaderCwd = config.leader_cwd ?? cwd;\n  const approvedExecutionState = await resolvePersistedApprovedTeamExecutionContinuityState(\n    sanitized,\n    leaderCwd,\n    config.team_state_root ?? resolveCanonicalTeamStateRoot(leaderCwd),","sourceCodeStart":5594,"sourceCodeEnd":5630,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/team/runtime.ts#L5594-L5630","documentation":"Thrown at the end of team shutdown/cleanup when one or more cleanup steps (state sync, artifact removal, etc.) failed; the message is the joined list of individual cleanup errors.","triggerScenarios":"Any cleanupError accumulated during shutdown finalization, e.g. failing to sync team mode state (syncTeamModeStateOnShutdown prerequisites missing) or write/remove state files.","commonSituations":"Read-only or missing team state root, partial deletion of the state directory, or disk/permission problems during shutdown.","solutions":["Read the joined messages to identify which cleanup step failed","Fix the underlying filesystem/permission issue on the team state root","Rerun shutdown; if state is already partially gone, remove the state dir manually"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await shutdown(...) } catch (e) { const parts = String(e).split(' | '); /* handle each cleanup error individually */ }","preventionTips":["Keep the team state root writable","Don't delete parts of the state dir manually before shutdown"],"tags":["team","shutdown","cleanup","filesystem"],"backgroundTag":"cleanup-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}