{"record":{"id":"9901bc5a8c7fd462","repo":"tinyhumansai/openhuman","slug":"missing-value-for-port","errorCode":null,"errorMessage":"missing value for --port","messagePattern":"missing value for --port","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/cli.rs","lineNumber":374,"sourceCode":"/// # Arguments\n///\n/// * `args` - Command-line arguments for the `run` command (e.g., `--port`).\nfn run_server_command(args: &[String]) -> Result<()> {\n    let mut port: Option<u16> = None;\n    let mut host: Option<String> = None;\n    let mut socketio_enabled = true;\n    let mut headless_api = false;\n    let mut verbose = false;\n    let log_scope = CliLogDefault::Global;\n    let mut i = 0usize;\n\n    // Manual argument parsing loop for specific flags.\n    while i < args.len() {\n        match args[i].as_str() {\n            \"--port\" => {\n                let raw = args\n                    .get(i + 1)\n                    .ok_or_else(|| anyhow::anyhow!(\"missing value for --port\"))?;\n                port = Some(\n                    raw.parse::<u16>()\n                        .map_err(|e| anyhow::anyhow!(\"invalid --port: {e}\"))?,\n                );\n                i += 2;\n            }\n            \"--host\" => {\n                host = Some(\n                    args.get(i + 1)\n                        .ok_or_else(|| anyhow::anyhow!(\"missing value for --host\"))?\n                        .clone(),\n                );\n                i += 2;\n            }\n            \"--jsonrpc-only\" => {\n                socketio_enabled = false;\n                i += 1;\n            }","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/a221052e0df5b1f7598fceba7329fd1af95d6699/src/core/cli.rs#L356-L392","documentation":"`openhuman run --port` expects a value in the next token and the flag was the last argument, so `args.get(i + 1)` returned None. Note this parser does not reject flag-looking values (unlike the launch-option parser), so `--port --host x` does NOT hit this — the '--host' token is consumed as the value and fails later as 'invalid --port'.","triggerScenarios":"`openhuman run --port` as the final token; a script appending --port conditionally without its value.","commonSituations":"Flag/value pairs split across script lines or variables with the value half missing; docs copy-paste that drops the value; assuming the port flag is a no-arg switch.","solutions":["Pass the port: `openhuman run --port 7788`","Or omit the flag and use the default (7788, or OPENHUMAN_CORE_PORT)"],"exampleFix":"# before\nopenhuman run --port\n# after\nopenhuman run --port 7788","handlingStrategy":"validation","validationCode":"# bash: only emit --port when a value is actually available\nargs=(run)\n[ -n \"${PORT:-}\" ] && args+=(--port \"$PORT\")\nexec openhuman \"${args[@]}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build flag/value pairs as adjacent array elements so one can never dangle","Rely on the default (7788 / OPENHUMAN_CORE_PORT) instead of passing a bare --port","Note the parser consumes the next token blindly — put --port's value immediately after the flag"],"tags":["cli","argument-parsing","server"],"backgroundTag":null,"analyzedSha":"a221052e0df5b1f7598fceba7329fd1af95d6699","analyzedAt":"2026-08-16T12:47:06.542Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}