{"record":{"id":"cbd6eb5e5e735169","repo":"paperclipai/paperclip","slug":"prompt-text-is-required","errorCode":null,"errorMessage":"Prompt text is required","messagePattern":"Prompt text is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/prompt.ts","lineNumber":239,"sourceCode":"}\n\nfunction wakeAgent(\n  api: { post<T>(path: string, body?: unknown): Promise<T | null> },\n  agentId: string,\n  issueId: string,\n  reason: string,\n): Promise<unknown> {\n  return api.post(apiPath`/api/agents/${agentId}/wakeup`, {\n    source: \"on_demand\",\n    triggerDetail: \"manual\",\n    reason,\n    payload: { issueId },\n  });\n}\n\nfunction normalizePrompt(prompt: string): string {\n  const normalized = prompt.trim();\n  if (!normalized) throw new Error(\"Prompt text is required\");\n  return normalized;\n}\n\nfunction defaultPromptTitle(prompt: string): string {\n  const firstLine = prompt.split(/\\r?\\n/).map((line) => line.trim()).find(Boolean) ?? \"Prompt handoff\";\n  return firstLine.length > 100 ? `${firstLine.slice(0, 97)}...` : firstLine;\n}\n\nfunction assertAgentMatchesReference(agent: Agent, reference: string): void {\n  const normalized = reference.trim().toLowerCase();\n  if (!normalized) throw new Error(\"Agent reference is required\");\n  const matches = [\n    agent.id,\n    agent.name,\n    typeof agent.urlKey === \"string\" ? agent.urlKey : null,\n  ].some((value) => value?.toLowerCase() === normalized);\n  if (!matches) {\n    throw new Error(","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/prompt.ts#L221-L257","documentation":"`normalizePrompt` trims the prompt text and throws if the result is empty. The prompt arrives as a variadic Commander argument (`<prompt...>`) joined with spaces, so an all-whitespace or empty join produces this error. This guards downstream issue creation/comment APIs that require non-empty content.","triggerScenarios":"Passing only whitespace as the prompt; an env-var expansion that yielded an empty string; a script that builds the prompt from an empty variable; piping nothing where a prompt was expected.","commonSituations":"Shell variable that was unset/empty and expanded to nothing (`paperclipai agent prompt \"$MAYBE_EMPTY\"`); CI step that passes a template string left blank; accidental trailing redirect.","solutions":["Provide non-empty prompt text as the final argument(s)","If the prompt comes from a variable, default or validate it first: `prompt=${PROMPT:?prompt is required}`","Strip-only-whitespace inputs are rejected, so ensure at least one non-whitespace character"],"exampleFix":"# before\npaperclipai agent prompt \"$EMPTY_VAR\"\n# after\npaperclipai agent prompt \"Implement the login endpoint\"","handlingStrategy":"validation","validationCode":"function normalizeOrReject(prompt: string): string {\n  const trimmed = prompt.trim();\n  if (!trimmed) throw new Error(\"Prompt text is required\");\n  return trimmed;\n}\nconst prompt = normalizeOrReject(rawPrompt);","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === \"string\" && v.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Default or fail on empty prompt variables: `prompt=${PROMPT:?required}`","Strip and check prompt length in scripts before invoking","Never assume the variadic prompt arg is non-empty"],"tags":["cli","validation","prompt","input"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}