paperclipai/paperclip · error · Error

Selected LLM Wiki project was not found.

Error message

Selected LLM Wiki project was not found.

What it means

Thrown by selectWikiProjectResource when ctx.projects.get(projectId, companyId) returns nullish. The lookup is company-scoped, so null means the project is missing, deleted, or belongs to a different company. The Wiki project binding must reference a project in the same company.

Source

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

    reconcileWikiAgentResource(ctx, companyId),
    reconcileWikiProjectResource(ctx, companyId),
  ]);

  const managedRoutines = await Promise.all(
    WIKI_MAINTENANCE_ROUTINE_KEYS.map((routineKey) =>
      ctx.routines.managed.reconcile(routineKey, companyId, {
        assigneeAgentId: managedAgent.agentId,
        projectId: managedProject.projectId,
      })),
  );

  return { managedAgent, managedProject, managedRoutines };
}

export async function selectWikiProjectResource(ctx: PluginContext, input: { companyId: string; projectId: string }): Promise<WikiProjectResource> {
  const project = await ctx.projects.get(input.projectId, input.companyId);
  if (!project) {
    throw new Error("Selected LLM Wiki project was not found.");
  }
  await upsertResourceBinding(ctx, {
    companyId: input.companyId,
    wikiId: DEFAULT_WIKI_ID,
    resourceKind: "project",
    resourceKey: WIKI_PROJECT_KEY,
    resolvedId: project.id,
    metadata: { source: "selected-existing", updatedBy: "settings" },
  });
  return projectResource({ status: "resolved", source: "selected", project });
}

export async function listWikiAgentOptions(ctx: PluginContext, companyId: string): Promise<WikiResourceOption[]> {
  const agents = await ctx.agents.list({ companyId, limit: 200 });
  return agents
    .filter((agent) => agent.status !== "terminated")
    .map((agent) => ({
      id: agent.id,

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. List project options via listWikiProjectOptions (or ctx.projects.list) and select an existing one for the company.
  2. Fall back to resetWikiProjectResource to bind the managed default project.
  3. Confirm the companyId owns the projectId before submitting.
  4. If the project was just created, ensure it is readable before binding.

Example fix

// before
await selectWikiProjectResource(ctx, { companyId, projectId: pickedProjectId });

// after
const opts = await listWikiProjectOptions(ctx, companyId);
const live = opts.find((p) => p.id === pickedProjectId);
if (!live) {
  return selectWikiProjectResource(await resetWikiProjectResource(ctx, companyId));
}
await selectWikiProjectResource(ctx, { companyId, projectId: live.id });
Defensive patterns

Strategy: validation

Validate before calling

async function ensureSelectableProject(ctx, companyId, projectId) {
  const opts = await listWikiProjectOptions(ctx, companyId);
  if (!opts.some((p) => p.id === projectId)) {
    throw new Error("Selected LLM Wiki project was not found.");
  }
}

Type guard

function isExistingProject(project) {
  return !!project && typeof project.id === "string";
}

Try / catch

try {
  await selectWikiProjectResource(ctx, { companyId, projectId });
} catch (err) {
  if (/Selected LLM Wiki project was not found/.test(err.message)) {
    return resetWikiProjectResource(ctx, companyId);
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling selectWikiProjectResource with a projectId that does not exist, was deleted, or is owned by another company.

Common situations: Stale project id in a dropdown after deletion; cross-company project reference; test fixture pointing at a removed project; race between project creation and selection.

Related errors


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