{"record":{"id":"08dce3ad99569f31","repo":"paperclipai/paperclip","slug":"workspaceid-is-required-for-update","errorCode":null,"errorMessage":"workspaceId is required for update","messagePattern":"workspaceId is required for update","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/workspace.ts","lineNumber":279,"sourceCode":"          printOutput(result, { json: ctx.json });\n        } catch (err) {\n          handleCommandError(err);\n        }\n      }),\n  );\n}\n\nfunction addProjectWorkspaceJson(parent: Command, name: string, description: string, method: \"post\" | \"patch\"): void {\n  addCommonClientOptions(\n    parent\n      .command(name)\n      .description(description)\n      .argument(\"<projectId>\", \"Project ID\")\n      .argument(\"[workspaceId]\", \"Workspace ID for update\")\n      .requiredOption(\"--payload-json <json>\", \"JSON payload\")\n      .action(async (projectId: string, workspaceId: string | undefined, opts: JsonPayloadOptions) => {\n        try {\n          if (method === \"patch\" && !workspaceId) throw new Error(\"workspaceId is required for update\");\n          const ctx = resolveCommandContext(opts);\n          const path = method === \"post\"\n            ? apiPath`/api/projects/${projectId}/workspaces`\n            : apiPath`/api/projects/${projectId}/workspaces/${workspaceId}`;\n          const result = method === \"post\"\n            ? await ctx.api.post(path, parseJson(opts.payloadJson))\n            : await ctx.api.patch(path, parseJson(opts.payloadJson));\n          printOutput(result, { json: ctx.json });\n        } catch (err) {\n          handleCommandError(err);\n        }\n      }),\n  );\n}\n\nfunction addProjectRuntimeAction(parent: Command, name: string, description: string, actionResource: string): void {\n  addCommonClientOptions(\n    parent","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/workspace.ts#L261-L297","documentation":"Thrown by addProjectWorkspaceJson (workspace.ts:279) when method is 'patch' and the optional [workspaceId] argument was not supplied. A PATCH must target a specific workspace, so the missing identifier is a hard pre-flight error before any API call.","triggerScenarios":"Running the update subcommand with only the projectId argument, e.g. `paperclipai ... workspace update <projectId> --payload-json '{...}'`, omitting the workspaceId positional. POST (create) does not require it; PATCH (update) does.","commonSituations":"Confusing the create vs update argument arity, or a script that always passes one positional regardless of the subcommand.","solutions":["Supply the workspaceId as the second positional: workspace update <projectId> <workspaceId> --payload-json '{...}'.","For creating a workspace, use the create subcommand which only needs projectId.","If scripting, branch on the subcommand to pass the correct positional count."],"exampleFix":"// before\npaperclipai ... workspace update proj-123 --payload-json '{...}'\n// after\npaperclipai ... workspace update proj-123 ws-456 --payload-json '{...}'","handlingStrategy":"validation","validationCode":"function requireWorkspaceIdForPatch(method: 'post' | 'patch', workspaceId: string | undefined): string {\n  if (method === 'patch' && !workspaceId) {\n    throw new Error('workspaceId is required for update; supply it as the second positional argument.');\n  }\n  return workspaceId!;\n}","typeGuard":"function hasWorkspaceIdForPatch(method: string, id: string | undefined): id is string {\n  return method !== 'patch' || (typeof id === 'string' && id.length > 0);\n}","tryCatchPattern":null,"preventionTips":["Remember create takes 1 positional, update takes 2.","In scripts, branch on the subcommand to supply the right positional count.","Use the workspace list command to copy the workspaceId before update."],"tags":["cli","argument-validation","workspace","rest"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}