paperclipai/paperclip · error · Error

LLM Wiki space status must be active or archived.

Error message

LLM Wiki space status must be active or archived.

What it means

Thrown by updateSpace when input.status is provided and is neither 'active' nor 'archived'. Spaces only support those two lifecycle statuses.

Source

Thrown at packages/plugins/plugin-llm-wiki/src/wiki/core.ts:1468

    configuredRootPath: null,
    accessScope,
    ownerUserId: null,
    ownerAgentId: null,
    teamKey: null,
    settings: input.settings ?? {},
    status: "active",
    createdAt: null,
    updatedAt: null,
  };
  await bootstrapSpaceFiles(ctx, input.companyId, space);
  await upsertWikiInstance(ctx, { companyId: input.companyId, wikiId });
  return { status: "created", space };
}

export async function updateSpace(ctx: PluginContext, input: UpdateSpaceInput): Promise<{ status: "ok"; space: WikiSpace }> {
  const nextStatus = input.status ?? null;
  if (nextStatus !== null && nextStatus !== "active" && nextStatus !== "archived") {
    throw new Error("LLM Wiki space status must be active or archived.");
  }
  const space = nextStatus === "active" ? await resolveSpaceAnyStatus(ctx, input) : await resolveSpace(ctx, input);
  const nextDisplayName = stringField(input.displayName);
  if (space.slug === DEFAULT_SPACE_SLUG && nextStatus === "archived") {
    throw new Error("The default LLM Wiki space cannot be archived.");
  }
  await ctx.db.execute(
    `UPDATE ${spaceTable(ctx)}
        SET display_name = COALESCE($4, display_name),
            settings = CASE WHEN $5::jsonb IS NULL THEN settings ELSE settings || $5::jsonb END,
            status = COALESCE($6, status),
            updated_at = now()
      WHERE company_id = $1 AND wiki_id = $2 AND slug = $3`,
    [
      input.companyId,
      space.wikiId,
      space.slug,
      nextDisplayName,

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Only pass 'active' or 'archived' as status (or omit it to leave unchanged).
  2. Constrain the status field at the API boundary to the two allowed values.
  3. To soft-remove a space, use 'archived' (and note the default space cannot be archived).

Example fix

// before
await updateSpace(ctx, { companyId, spaceSlug, status: "paused" });

// after
await updateSpace(ctx, { companyId, spaceSlug, status: "archived" });
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED_STATUS = new Set(["active", "archived"]);
function sanitizeSpaceStatus(status) {
  if (status != null && !ALLOWED_STATUS.has(status)) {
    throw new Error(`LLM Wiki space status must be active or archived (got ${status})`);
  }
  return status;
}

Type guard

function isSpaceStatus(value) {
  return value == null || value === "active" || value === "archived";
}

Try / catch

try {
  await updateSpace(ctx, { companyId, spaceSlug, status });
} catch (err) {
  if (/status must be active or archived/.test(err.message)) {
    return updateSpace(ctx, { companyId, spaceSlug, status: "archived" });
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling updateSpace with status set to 'deleted', 'paused', 'draft', or any other string.

Common situations: 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.

Related errors


AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12). Data as JSON: /api/errors/bd9aeb2069195aee. Report an issue: GitHub.