tinyhumansai/openhuman · error · PaymentRequiredError

PAYMENT_REQUIRED

Error message

PAYMENT_REQUIRED

What it means

Required-flag error from `openhuman memory clear`. After the parsing loop, `--namespace` was never supplied. The requirement is deliberate: clear removes a namespace's contents, so there is no implicit default — you must name the target explicitly. This is the destructive twin of the query requirement (error 367).

Source

Thrown at app/src/lib/agentworld/invokeApiClient.ts:86

  params?: Record<string, unknown>,
  timeoutMs?: number
): Promise<T> {
  try {
    return await callCoreRpc<T>({
      method,
      params,
      ...(timeoutMs !== undefined ? { timeoutMs } : {}),
    });
  } catch (err) {
    // Core serialises 402 errors as a plain string "PAYMENT_REQUIRED:<json>".
    const msg = String(err);
    const prefix = 'PAYMENT_REQUIRED:';
    if (msg.includes(prefix)) {
      // Extract everything after the prefix, handling cases where the error
      // message has extra surrounding text from JSON-RPC wrapping.
      const idx = msg.indexOf(prefix);
      const payload = msg.slice(idx + prefix.length);
      throw new PaymentRequiredError(safeParseJson(payload));
    }
    throw err;
  }
}

// ── Types (inline minimal stubs — replace with SDK types when available) ──────
//
// These are structural interfaces that describe what the tiny.place backend
// returns. They mirror `sdk/typescript/src/types/`.  We declare them here
// (import-type-only) so the renderer tree never bundles the HTTP SDK runtime.
//
// When `@tinyhumansai/tinyplace` is published and added as a dev-dep, replace
// each `AgentQueryParams`, `AgentCard`, etc. with `import type { … } from
// '@tinyhumansai/tinyplace'`.

interface AgentQueryParams {
  q?: string;
  skill?: string;

View on GitHub (pinned to a221052e0d)

Solutions

  1. Pass the namespace explicitly: `openhuman memory clear --namespace cli`
  2. List namespaces first with `openhuman memory namespaces` if unsure of the name
  3. Quote and default-check the variable in scripts: `[ -n "$NS" ] || exit 1`

Example fix

# before
openhuman memory clear
# after
openhuman memory clear --namespace cli
Defensive patterns

Strategy: validation

Validate before calling

# bash: never invoke clear without an explicit namespace
[ -n "${NS:-}" ] || { echo 'refusing to clear without --namespace' >&2; exit 2; }
openhuman memory clear --namespace "$NS"

Try / catch

if ! out=$(openhuman memory clear "$@" 2>&1); then
  case "$out" in *"--namespace is required"*) openhuman memory namespaces >&2; exit 2;; esac
  printf '%s\n' "$out" >&2; exit 1
fi

Prevention

When it happens

Trigger: `openhuman memory clear -v`; `openhuman memory clear` with no arguments; a script whose namespace variable resolved empty so the flag was skipped.

Common situations: Running clear as a quick 'reset everything' and expecting a prompt or default; empty-variable interpolation in automation; onboarding docs that show clear without the flag.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@a221052e0d (2026-08-16). Data as JSON: /api/errors/3291b01d34e66d92. Report an issue: GitHub.