tinyhumansai/openhuman · error · PaymentRequiredError

PAYMENT_REQUIRED

PAYMENT_REQUIRED

Error message

PAYMENT_REQUIRED

What it means

Missing-value error from `parse_tick_flags` in the subconscious CLI. `--mode`/`-m` expects its value (simple|aggressive) as the immediately next token; when the flag is last on the line, `args.get(i + 1)` is None and this error fires. Note this is distinct from the follow-on validation error: a PRESENT but invalid value yields "unknown mode '{other}', expected simple|aggressive" instead.

Source

Thrown at app/src/lib/orchestration/orchestrationClient.ts:244

  }
}

/**
 * Call a `openhuman.orchestration_*` method and return the typed result.
 *
 * The core serialises 402 errors as a plain string `"PAYMENT_REQUIRED:<json>"`;
 * we decode it into a {@link PaymentRequiredError} so callers can render the
 * paywall state, matching `invokeApiClient`. All other errors propagate as-is.
 */
async function call<T>(method: string, params?: Record<string, unknown>): Promise<T> {
  try {
    return await callCoreRpc<T>({ method, params: params ?? {} });
  } catch (err) {
    const msg = String(err);
    const prefix = 'PAYMENT_REQUIRED:';
    const idx = msg.indexOf(prefix);
    if (idx >= 0) {
      throw new PaymentRequiredError(safeParseJson(msg.slice(idx + prefix.length)));
    }
    throw err;
  }
}

// ── Public API ────────────────────────────────────────────────────────────────

export const orchestrationClient = {
  /** List all orchestration chats (pinned master + subconscious, plus sessions). */
  sessionsList: () => call<SessionsListResponse>('openhuman.orchestration_sessions_list', {}),

  /** Create a new empty session for a contact; returns the created summary. */
  sessionsCreate: (params: { agentId: string; label?: string }) =>
    call<SessionCreateResponse>('openhuman.orchestration_sessions_create', {
      agentId: params.agentId,
      ...(params.label !== undefined ? { label: params.label } : {}),
    }),

View on GitHub (pinned to a221052e0d)

Solutions

  1. Pass the mode as the next token: `--mode aggressive` (or `--mode simple`)
  2. Or omit the flag to use the configured/default mode
  3. Validate the value client-side against {simple, aggressive} before invoking

Example fix

# before
openhuman subconscious tick --mode
# after
openhuman subconscious tick --mode aggressive
Defensive patterns

Strategy: validation

Validate before calling

# bash: validate mode value AND pairing before invoking
case "${MODE:-}" in ""|simple|aggressive) ;; *) echo "mode must be simple|aggressive" >&2; exit 2;; esac
if [ -n "$MODE" ]; then set -- --mode "$MODE" "$@"; fi
openhuman subconscious tick "$@"

Type guard

is_subconscious_mode() { case "$1" in simple|aggressive) return 0;; *) return 1;; esac; }

Try / catch

if ! out=$(openhuman subconscious tick "$@" 2>&1); then
  case "$out" in *"missing value for --mode"*) echo 'pass simple|aggressive as the next token' >&2; exit 2;; *"unknown mode"*) echo 'expected simple|aggressive' >&2; exit 2;; esac
  printf '%s\n' "$out" >&2; exit 1
fi

Prevention

When it happens

Trigger: `openhuman subconscious tick --mode` at end of line; `-m` as the final token; the value line of a backslash-continued command deleted.

Common situations: Truncated command lines; scripts appending the flag with an empty mode variable.

Related errors


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