{"record":{"id":"fd8b75212234a5f3","repo":"paperclipai/paperclip","slug":"the-default-llm-wiki-space-cannot-be-archived","errorCode":null,"errorMessage":"The default LLM Wiki space cannot be archived.","messagePattern":"The default LLM Wiki space cannot be archived\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/plugins/plugin-llm-wiki/src/wiki/core.ts","lineNumber":1473,"sourceCode":"    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,\n      input.settings ? jsonParam(input.settings) : null,\n      nextStatus ?? null,\n    ],\n  );\n  if (nextStatus === \"archived\") {","sourceCodeStart":1455,"sourceCodeEnd":1491,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/packages/plugins/plugin-llm-wiki/src/wiki/core.ts#L1455-L1491","documentation":"Thrown by updateSpace when the resolved space is the default space (slug === DEFAULT_SPACE_SLUG) and the caller tries to set its status to 'archived'. The default space is required infrastructure and cannot be archived via the update path.","triggerScenarios":"Calling updateSpace on the default space with status: 'archived'.","commonSituations":"Bulk-archiving all spaces without excluding the default; UI 'archive all' action; script treating every space uniformly.","solutions":["Exclude the default space from archive operations.","If you need to disable ingestion on the default space, disable the ingestion profile instead of archiving the space.","Skip status updates for slug === 'default'."],"exampleFix":"// before\nfor (const s of spaces) {\n  await updateSpace(ctx, { companyId, spaceSlug: s.slug, status: \"archived\" });\n}\n\n// after\nfor (const s of spaces) {\n  if (s.slug === DEFAULT_SPACE_SLUG) continue;\n  await updateSpace(ctx, { companyId, spaceSlug: s.slug, status: \"archived\" });\n}","handlingStrategy":"type-guard","validationCode":"function assertNotArchivingDefault(slug, status) {\n  if (slug === \"default\" && status === \"archived\") {\n    throw new Error(\"The default LLM Wiki space cannot be archived.\");\n  }\n}","typeGuard":"function isArchiveDefaultViolation(slug, status) {\n  return slug === \"default\" && status === \"archived\";\n}","tryCatchPattern":"try {\n  await updateSpace(ctx, { companyId, spaceSlug, status });\n} catch (err) {\n  if (/default LLM Wiki space cannot be archived/.test(err.message)) {\n    // disable ingestion instead\n    return updatePaperclipIngestionProfile(ctx, { companyId, spaceSlug, profile: { ...profile, enabled: false } });\n  }\n  throw err;\n}","preventionTips":["Exclude slug 'default' from bulk archive actions.","To pause the default space, disable its ingestion profile instead.","Surface the constraint in the UI before submission."],"tags":["validation","wiki","spaces","default-space","paperclip"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}