paperclipai/paperclip · error · Error
workspaceId is required for update
Error message
workspaceId is required for update
What it means
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.
Source
Thrown at cli/src/commands/client/workspace.ts:279
printOutput(result, { json: ctx.json });
} catch (err) {
handleCommandError(err);
}
}),
);
}
function addProjectWorkspaceJson(parent: Command, name: string, description: string, method: "post" | "patch"): void {
addCommonClientOptions(
parent
.command(name)
.description(description)
.argument("<projectId>", "Project ID")
.argument("[workspaceId]", "Workspace ID for update")
.requiredOption("--payload-json <json>", "JSON payload")
.action(async (projectId: string, workspaceId: string | undefined, opts: JsonPayloadOptions) => {
try {
if (method === "patch" && !workspaceId) throw new Error("workspaceId is required for update");
const ctx = resolveCommandContext(opts);
const path = method === "post"
? apiPath`/api/projects/${projectId}/workspaces`
: apiPath`/api/projects/${projectId}/workspaces/${workspaceId}`;
const result = method === "post"
? await ctx.api.post(path, parseJson(opts.payloadJson))
: await ctx.api.patch(path, parseJson(opts.payloadJson));
printOutput(result, { json: ctx.json });
} catch (err) {
handleCommandError(err);
}
}),
);
}
function addProjectRuntimeAction(parent: Command, name: string, description: string, actionResource: string): void {
addCommonClientOptions(
parentView on GitHub (pinned to 67001ec6eb)
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.
Example fix
// before
paperclipai ... workspace update proj-123 --payload-json '{...}'
// after
paperclipai ... workspace update proj-123 ws-456 --payload-json '{...}' Defensive patterns
Strategy: validation
Validate before calling
function requireWorkspaceIdForPatch(method: 'post' | 'patch', workspaceId: string | undefined): string {
if (method === 'patch' && !workspaceId) {
throw new Error('workspaceId is required for update; supply it as the second positional argument.');
}
return workspaceId!;
} Type guard
function hasWorkspaceIdForPatch(method: string, id: string | undefined): id is string {
return method !== 'patch' || (typeof id === 'string' && id.length > 0);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Confusing the create vs update argument arity, or a script that always passes one positional regardless of the subcommand.
Related errors
- Invalid --adapter-override "${raw}". Use slug=type.
- Invalid ${flag} "${raw}". Use ${format}.
- Agent reference is required
- Invalid --expires-at value: ${opts.expiresAt}
- Invalid --ttl-days value: ${opts.ttlDays}
AI-assisted analysis of paperclipai/paperclip@67001ec6eb (2026-08-12).
Data as JSON: /api/errors/08dce3ad99569f31.
Report an issue: GitHub.