{"record":{"id":"bd9aeb2069195aee","repo":"paperclipai/paperclip","slug":"llm-wiki-space-status-must-be-active-or-archived","errorCode":null,"errorMessage":"LLM Wiki space status must be active or archived.","messagePattern":"LLM Wiki space status must be active or archived\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":1468,"sourceCode":"    configuredRootPath: null,\n    accessScope,\n    ownerUserId: null,\n    ownerAgentId: null,\n    teamKey: null,\n    settings: input.settings ?? {},\n    status: \"active\",\n    createdAt: null,\n    updatedAt: null,\n  };\n  await bootstrapSpaceFiles(ctx, input.companyId, space);\n  await upsertWikiInstance(ctx, { companyId: input.companyId, wikiId });\n  return { status: \"created\", space };\n}\n\nexport async function updateSpace(ctx: PluginContext, input: UpdateSpaceInput): Promise<{ status: \"ok\"; space: WikiSpace }> {\n  const nextStatus = input.status ?? null;\n  if (nextStatus !== null && nextStatus !== \"active\" && nextStatus !== \"archived\") {\n    throw new Error(\"LLM Wiki space status must be active or archived.\");\n  }\n  const space = nextStatus === \"active\" ? await resolveSpaceAnyStatus(ctx, input) : await resolveSpace(ctx, input);\n  const nextDisplayName = stringField(input.displayName);\n  if (space.slug === DEFAULT_SPACE_SLUG && nextStatus === \"archived\") {\n    throw new Error(\"The default LLM Wiki space cannot be archived.\");\n  }\n  await ctx.db.execute(\n    `UPDATE ${spaceTable(ctx)}\n        SET display_name = COALESCE($4, display_name),\n            settings = CASE WHEN $5::jsonb IS NULL THEN settings ELSE settings || $5::jsonb END,\n            status = COALESCE($6, status),\n            updated_at = now()\n      WHERE company_id = $1 AND wiki_id = $2 AND slug = $3`,\n    [\n      input.companyId,\n      space.wikiId,\n      space.slug,\n      nextDisplayName,","sourceCodeStart":1450,"sourceCodeEnd":1486,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L1450-L1486","documentation":"Thrown by updateSpace when input.status is provided and is neither 'active' nor 'archived'. Spaces only support those two lifecycle statuses.","triggerScenarios":"Calling updateSpace with status set to 'deleted', 'paused', 'draft', or any other string.","commonSituations":"Sending a generic lifecycle status from a shared enum; UI dropdown exposing statuses that are not implemented; copy-pasted payload with a wrong status value.","solutions":["Only pass 'active' or 'archived' as status (or omit it to leave unchanged).","Constrain the status field at the API boundary to the two allowed values.","To soft-remove a space, use 'archived' (and note the default space cannot be archived)."],"exampleFix":"// before\nawait updateSpace(ctx, { companyId, spaceSlug, status: \"paused\" });\n\n// after\nawait updateSpace(ctx, { companyId, spaceSlug, status: \"archived\" });","handlingStrategy":"validation","validationCode":"const ALLOWED_STATUS = new Set([\"active\", \"archived\"]);\nfunction sanitizeSpaceStatus(status) {\n  if (status != null && !ALLOWED_STATUS.has(status)) {\n    throw new Error(`LLM Wiki space status must be active or archived (got ${status})`);\n  }\n  return status;\n}","typeGuard":"function isSpaceStatus(value) {\n  return value == null || value === \"active\" || value === \"archived\";\n}","tryCatchPattern":"try {\n  await updateSpace(ctx, { companyId, spaceSlug, status });\n} catch (err) {\n  if (/status must be active or archived/.test(err.message)) {\n    return updateSpace(ctx, { companyId, spaceSlug, status: \"archived\" });\n  }\n  throw err;\n}","preventionTips":["Constrain status to 'active' or 'archived' at the boundary.","Omit status when you do not intend to change it.","Do not feed generic lifecycle enums into space updates."],"tags":["validation","wiki","spaces","lifecycle","paperclip"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}