paperclipai/paperclip · error · Error

Prompt text is required

Error message

Prompt text is required

What it means

`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.

Source

Thrown at cli/src/commands/client/prompt.ts:239

}

function wakeAgent(
  api: { post<T>(path: string, body?: unknown): Promise<T | null> },
  agentId: string,
  issueId: string,
  reason: string,
): Promise<unknown> {
  return api.post(apiPath`/api/agents/${agentId}/wakeup`, {
    source: "on_demand",
    triggerDetail: "manual",
    reason,
    payload: { issueId },
  });
}

function normalizePrompt(prompt: string): string {
  const normalized = prompt.trim();
  if (!normalized) throw new Error("Prompt text is required");
  return normalized;
}

function defaultPromptTitle(prompt: string): string {
  const firstLine = prompt.split(/\r?\n/).map((line) => line.trim()).find(Boolean) ?? "Prompt handoff";
  return firstLine.length > 100 ? `${firstLine.slice(0, 97)}...` : firstLine;
}

function assertAgentMatchesReference(agent: Agent, reference: string): void {
  const normalized = reference.trim().toLowerCase();
  if (!normalized) throw new Error("Agent reference is required");
  const matches = [
    agent.id,
    agent.name,
    typeof agent.urlKey === "string" ? agent.urlKey : null,
  ].some((value) => value?.toLowerCase() === normalized);
  if (!matches) {
    throw new Error(

View on GitHub (pinned to 67001ec6eb)

Solutions

  1. Provide non-empty prompt text as the final argument(s)
  2. If the prompt comes from a variable, default or validate it first: `prompt=${PROMPT:?prompt is required}`
  3. Strip-only-whitespace inputs are rejected, so ensure at least one non-whitespace character

Example fix

# before
paperclipai agent prompt "$EMPTY_VAR"
# after
paperclipai agent prompt "Implement the login endpoint"
Defensive patterns

Strategy: validation

Validate before calling

function normalizeOrReject(prompt: string): string {
  const trimmed = prompt.trim();
  if (!trimmed) throw new Error("Prompt text is required");
  return trimmed;
}
const prompt = normalizeOrReject(rawPrompt);

Type guard

function isNonEmptyString(v: unknown): v is string {
  return typeof v === "string" && v.trim().length > 0;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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