{"record":{"id":"a36addba5beccfaf","repo":"tinyhumansai/openhuman","slug":"invalid-paramname-value-id-is-out-of-the-v","errorCode":null,"errorMessage":"Invalid ${paramName}: ${value}. ID is out of the valid integer range.","messagePattern":"Invalid (.+?): (.+?)\\. ID is out of the valid integer range\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"app/src/lib/mcp/validation.ts","lineNumber":19,"sourceCode":"/**\n * Validation utilities for MCP tools\n */\n\nexport class ValidationError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = 'ValidationError';\n  }\n}\n\n/**\n * Validate chat_id or user_id parameter\n * Supports integer IDs, string IDs, and usernames\n */\nexport function validateId(value: unknown, paramName: string): number | string {\n  if (typeof value === 'number') {\n    if (!Number.isInteger(value) || value < -(2 ** 63) || value > 2 ** 63 - 1) {\n      throw new ValidationError(\n        `Invalid ${paramName}: ${value}. ID is out of the valid integer range.`\n      );\n    }\n    return value;\n  }\n\n  if (typeof value === 'string') {\n    const intValue = Number.parseInt(value, 10);\n    if (!Number.isNaN(intValue) && Number.isFinite(intValue)) {\n      if (intValue < -(2 ** 63) || intValue > 2 ** 63 - 1) {\n        throw new ValidationError(\n          `Invalid ${paramName}: ${value}. ID is out of the valid integer range.`\n        );\n      }\n      return intValue;\n    }\n\n    if (/^@?[a-zA-Z0-9_]{5,}$/.test(value)) {","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/app/src/lib/mcp/validation.ts#L1-L37","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Supply the value as the next token: `--namespace docs`","Or delete the dangling flag entirely","Never use `--flag=value`; this parser only accepts space-separated values","Check shell line continuations (\\) near the flag for a missing next line"],"exampleFix":"# before\nopenhuman memory ingest notes.md --namespace\n# after\nopenhuman memory ingest notes.md --namespace docs","handlingStrategy":"validation","validationCode":"# bash: reject a trailing value-taking flag before invoking\nvalue_flags='--namespace|-n|--key|-k|--title|-t|--query|-q|--limit|-l|--subject|--predicate'\nlast=\"${!#}\"\nif [ $# -gt 0 ] && [[ \"$last\" =~ ^(${value_flags})$ ]]; then echo \"missing value for $last\" >&2; exit 2; fi\nopenhuman memory \"$@\"","typeGuard":null,"tryCatchPattern":"if ! out=$(openhuman memory \"$@\" 2>&1); then\n  case \"$out\" in *\"missing value for\"*) echo \"supply the value or drop the flag\" >&2; exit 2;; esac\n  printf '%s\\n' \"$out\" >&2; exit 1\nfi","preventionTips":["Build flag+value pairs as single units in scripts so one is never emitted without the other","Avoid `--flag=value` syntax — this parser only accepts space-separated values","Double-check backslash line continuations around value flags"],"tags":["cli","usage","argument-parsing","memory"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}