tinyhumansai/openhuman · error · ValidationError

Invalid ${paramName}: ${value}. ID is out of the valid integ

Error message

Invalid ${paramName}: ${value}. ID is out of the valid integer range.

What it means

Shared helper error from `next_arg` in the memory CLI. A value-taking flag (--namespace, --key, --title, --query, --limit, --subject, --predicate) was the LAST token on the command line, so `args.get(i + 1)` returned None. The flag name is interpolated into the message. The parser consumes exactly two tokens per value flag, so the value must be a separate following token.

Source

Thrown at app/src/lib/mcp/validation.ts:19

/**
 * Validation utilities for MCP tools
 */

export class ValidationError extends Error {
  constructor(message: string) {
    super(message);
    this.name = 'ValidationError';
  }
}

/**
 * Validate chat_id or user_id parameter
 * Supports integer IDs, string IDs, and usernames
 */
export function validateId(value: unknown, paramName: string): number | string {
  if (typeof value === 'number') {
    if (!Number.isInteger(value) || value < -(2 ** 63) || value > 2 ** 63 - 1) {
      throw new ValidationError(
        `Invalid ${paramName}: ${value}. ID is out of the valid integer range.`
      );
    }
    return value;
  }

  if (typeof value === 'string') {
    const intValue = Number.parseInt(value, 10);
    if (!Number.isNaN(intValue) && Number.isFinite(intValue)) {
      if (intValue < -(2 ** 63) || intValue > 2 ** 63 - 1) {
        throw new ValidationError(
          `Invalid ${paramName}: ${value}. ID is out of the valid integer range.`
        );
      }
      return intValue;
    }

    if (/^@?[a-zA-Z0-9_]{5,}$/.test(value)) {

View on GitHub (pinned to a221052e0d)

Solutions

  1. Supply the value as the next token: `--namespace docs`
  2. Or delete the dangling flag entirely
  3. Never use `--flag=value`; this parser only accepts space-separated values
  4. Check shell line continuations (\) near the flag for a missing next line

Example fix

# before
openhuman memory ingest notes.md --namespace
# after
openhuman memory ingest notes.md --namespace docs
Defensive patterns

Strategy: validation

Validate before calling

# bash: reject a trailing value-taking flag before invoking
value_flags='--namespace|-n|--key|-k|--title|-t|--query|-q|--limit|-l|--subject|--predicate'
last="${!#}"
if [ $# -gt 0 ] && [[ "$last" =~ ^(${value_flags})$ ]]; then echo "missing value for $last" >&2; exit 2; fi
openhuman memory "$@"

Try / catch

if ! out=$(openhuman memory "$@" 2>&1); then
  case "$out" in *"missing value for"*) echo "supply the value or drop the flag" >&2; exit 2;; esac
  printf '%s\n' "$out" >&2; exit 1
fi

Prevention

When it happens

Trigger: `openhuman memory ingest -n` (flag at end); `openhuman memory query --query` followed by nothing; `openhuman memory graph --subject` as the last token; `--flag=value` is ALSO this error's neighbor — the `=` form is an unknown token instead, but a trailing bare flag is the classic trigger.

Common situations: Truncated command lines from shell history editing; line-continuation backslashes where the continuation line was deleted; scripts joining args where an optional value was empty and dropped.

Related errors


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