{"record":{"id":"7d914bf008fc4dfe","repo":"paperclipai/paperclip","slug":"failed-to-create-board-token","errorCode":null,"errorMessage":"Failed to create board token","messagePattern":"Failed to create board token","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/connect.ts","lineNumber":98,"sourceCode":"    command: \"paperclipai connect\",\n  });\n  const boardApi = new PaperclipApiClient({ apiBase, apiKey: boardLogin.token });\n  const companies = (await boardApi.get<Company[]>(\"/api/companies\")) ?? [];\n\n  const persona = await choosePersona(opts.persona);\n  const profileName = opts.profile?.trim() || await askProfileName(resolvedProfile.name);\n  const apiKeyEnvVarName = opts.apiKeyEnvVarName?.trim() || \"PAPERCLIP_API_KEY\";\n\n  if (persona === \"board\") {\n    const company = await chooseCompany(companies, opts.companyId ?? resolvedProfile.profile.companyId, {\n      optional: true,\n    });\n    const tokenName = opts.tokenName?.trim() || `cli-board-${new Date().toISOString()}`;\n    const key = await boardApi.post<CreatedBoardKey>(\"/api/board-api-keys\", createBoardApiKeySchema.parse({\n      name: tokenName,\n      requestedCompanyId: company?.id ?? null,\n    }));\n    if (!key) throw new Error(\"Failed to create board token\");\n    upsertProfile(profileName, {\n      apiBase,\n      companyId: company?.id,\n      persona: \"board\",\n      agentId: \"\",\n      agentName: \"\",\n      apiKeyEnvVarName,\n      tokenName: key.name,\n      tokenId: key.id,\n      tokenCreatedAt: key.createdAt,\n    }, opts.context);\n    setCurrentProfile(profileName, opts.context);\n    p.outro(pc.green(`Connected profile '${profileName}' as board.`));\n    return {\n      ok: true,\n      profile: profileName,\n      persona: \"board\",\n      apiBase,","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/connect.ts#L80-L116","documentation":"Thrown in connectWizard() (board persona branch) after POST /api/board-api-keys returns null. The board key creation endpoint is expected to return a CreatedBoardKey object (with id, name, createdAt, plaintext key); null means the server returned 204/empty body. Without the key material the wizard cannot persist a profile, so it aborts.","triggerScenarios":"The board-api-keys endpoint responds 204 No Content or an empty body; the endpoint is unimplemented on the targeted server version; a proxy strips the response; the create partially succeeded server-side but returned nothing.","commonSituations":"Server version mismatch (older server without board key creation); reverse proxy truncating the response; transient server error yielding 204; board token used to create the key lacks sufficient privilege and the server returns empty.","solutions":["Verify the endpoint returns a body: `curl -i -X POST <api-base>/api/board-api-keys -H 'authorization: Bearer <token>' -d '{\"name\":\"test\"}'`.","Confirm the server version implements board-api-keys creation.","Check that the board token used has key-management privilege.","Inspect server logs for an exception in the key-creation handler."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Probe the board-api-keys endpoint returns a body before relying on the wizard.\nasync function canCreateBoardKey(api: { post: (p: string, b?: unknown) => Promise<unknown> }): Promise<boolean> {\n  try {\n    const k = await api.post(\"/api/board-api-keys\", { name: \"probe\" });\n    return k != null && typeof (k as any).id === \"string\";\n  } catch { return false; }\n}","typeGuard":"import type { CreatedBoardKey } from \"@paperclipai/shared\";\n\nfunction isCreatedBoardKey(v: unknown): v is CreatedBoardKey {\n  return !!v && typeof v === \"object\"\n    && typeof (v as CreatedBoardKey).id === \"string\"\n    && typeof (v as CreatedBoardKey).name === \"string\";\n}","tryCatchPattern":"try {\n  const key = await boardApi.post<CreatedBoardKey>(\"/api/board-api-keys\", payload);\n  if (!isCreatedBoardKey(key)) throw new Error(\"Board key creation returned no key; check server version.\");\n} catch (err) {\n  throw err;\n}","preventionTips":["Confirm the server implements board-api-keys creation before scripting connect.","Ensure the board token used has key-management privilege.","Smoke-test the endpoint with curl -i after server upgrades."],"tags":["cli","connect","board-key","empty-response","authentication"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}