{"record":{"id":"921f500c95cacf9e","repo":"tinyhumansai/openhuman","slug":"invalid-paramname-index-errormsg","errorCode":null,"errorMessage":"Invalid ${paramName}[${index}]: ${errorMsg}","messagePattern":"Invalid (.+?)\\[(.+?)\\]: (.+?)","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"app/src/lib/mcp/validation.ts","lineNumber":67,"sourceCode":"}\n\n/**\n * Validate list of IDs\n */\nexport function validateIdList(value: unknown, paramName: string): Array<number | string> {\n  if (!Array.isArray(value)) {\n    throw new ValidationError(`Invalid ${paramName}: must be an array of IDs.`);\n  }\n\n  return value.map((item: unknown, index: number) => {\n    try {\n      return validateId(item, `${paramName}[${index}]`);\n    } catch (error) {\n      if (error instanceof ValidationError) {\n        throw error;\n      }\n      const errorMsg = error instanceof Error ? error.message : String(error);\n      throw new ValidationError(`Invalid ${paramName}[${index}]: ${errorMsg}`);\n    }\n  });\n}\n\n/**\n * Validate a positive integer parameter (e.g. message IDs)\n */\nexport function validatePositiveInt(value: unknown, paramName: string): number {\n  if (typeof value === 'number') {\n    if (!Number.isInteger(value) || value <= 0) {\n      throw new ValidationError(`Invalid ${paramName}: ${value}. Must be a positive integer.`);\n    }\n    return value;\n  }\n\n  if (typeof value === 'string') {\n    const intValue = Number.parseInt(value, 10);\n    if (Number.isNaN(intValue) || intValue <= 0) {","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/app/src/lib/mcp/validation.ts#L49-L85","documentation":"Missing-value error from `parse_tick_flags` in the subconscious CLI. `--workspace`/`-w` expects its path as the immediately next token; when the flag is the last token on the line, `args.get(i + 1)` is None and this error fires before any workspace is touched.","triggerScenarios":"`openhuman subconscious tick --workspace` (nothing after); `-w` as the final token; a shell line-continuation where the value line was lost; a script conditionally appending the flag but not the value.","commonSituations":"Truncated commands from history editing; templated invocations where the workspace variable was empty and only the flag survived.","solutions":["Supply the path as the next token: `--workspace /path/to/ws`","Or drop the flag to use the default workspace","Default empty variables in scripts instead of emitting a bare flag"],"exampleFix":"# before\nopenhuman subconscious tick --workspace\n# after\nopenhuman subconscious tick --workspace /tmp/fresh-ws","handlingStrategy":"validation","validationCode":"# bash: never emit a bare -w/--workspace\nif [ -n \"${WS:-}\" ]; then set -- --workspace \"$WS\" \"$@\"; fi   # pair built as a unit\nlast=\"${!#}\"\n[ \"$last\" = \"-w\" ] || [ \"$last\" = \"--workspace\" ] && { echo 'missing value for --workspace' >&2; exit 2; }\nopenhuman subconscious tick \"$@\"","typeGuard":null,"tryCatchPattern":"if ! out=$(openhuman subconscious tick \"$@\" 2>&1); then\n  case \"$out\" in *\"missing value for --workspace\"*) echo 'pass the path as the next token or drop the flag' >&2; exit 2;; esac\n  printf '%s\\n' \"$out\" >&2; exit 1\nfi","preventionTips":["Emit flag and value as one quoted unit from scripts so they can never separate"],"tags":["cli","usage","argument-parsing","subconscious"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}