{"record":{"id":"4d8a5262a64d197d","repo":"facebook/flow","slug":"invalid-line","errorCode":null,"errorMessage":"invalid line","messagePattern":"invalid line","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust_port/crates/flow_cli/src/autocomplete_command.rs","lineNumber":104,"sourceCode":"fn file_input_from_stdin(filename: Option<&str>) -> flow_server_utils::file_input::FileInput {\n    command_utils::get_file_from_filename_or_stdin(spec().name.as_str(), filename, None)\n}\n\nfn parse_args(\n    args: Option<Vec<String>>,\n) -> (flow_server_utils::file_input::FileInput, Option<(i32, i32)>) {\n    match args.as_deref() {\n        None | Some([]) => {\n            let input = file_input_from_stdin(None);\n            extract_cursor(input)\n        }\n        Some([filename]) => {\n            let input = file_input_from_stdin(Some(filename.as_str()));\n            extract_cursor(input)\n        }\n        Some([line, column]) => {\n            let cursor = command_utils::convert_input_pos(\n                line.parse().expect(\"invalid line\"),\n                column.parse().expect(\"invalid column\"),\n            );\n            let input = file_input_from_stdin(None);\n            (input, Some(cursor))\n        }\n        Some([filename, line, column]) => {\n            let cursor = command_utils::convert_input_pos(\n                line.parse().expect(\"invalid line\"),\n                column.parse().expect(\"invalid column\"),\n            );\n            let input = file_input_from_stdin(Some(filename.as_str()));\n            (input, Some(cursor))\n        }\n        _ => {\n            eprintln!(\n                \"{}\",\n                command_spec::command(spec(), |_| {}).string_of_usage()\n            );","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_cli/src/autocomplete_command.rs#L86-L122","documentation":"The autocomplete command parses positional arguments; in the two-argument form [line, column] (no filename, input read from stdin), the line argument goes through line.parse().expect(\"invalid line\"). Anything that is not a valid i32 — letters, empty string, floating point, or numbers beyond i32 range — panics with \"invalid line\" instead of printing a usage error.","triggerScenarios":"Calling the autocomplete command with exactly two positional args where the first is not an integer, e.g. flow autocomplete 12x 5 or flow autocomplete \"\" 5 (stdin supplies the file content).","commonSituations":"Editor integrations passing a cursor marker or flag where the line number belongs; copy-paste invocations missing the filename so arguments shift by one; scripts interpolating empty variables.","solutions":["Pass a 1-based integer for line: flow autocomplete 12 5.","Keep the argument order straight — [line column] or [filename line column]; a filename landing in the line slot is the usual shift.","Run the command with no arguments to see the usage string it prints."],"exampleFix":"# before: non-integer first argument in the [line, column] form\nflow autocomplete 12x 5    # panics: invalid line\n\n# after: 1-based integers\nflow autocomplete 12 5","handlingStrategy":"validation","validationCode":"# Validate both position args are integers before invoking autocomplete.\ncase \"$1$2\" in ''|*[!0-9-]*) echo \"line/column must be integers\"; exit 2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Editor integrations should validate/clamp cursor positions to 1-based integers before shelling out.","Keep argument order fixed: [line column] or [filename line column].","Reproduce panics by echoing the exact argument vector used."],"tags":["cli","autocomplete","argument-parsing","panic","rust"],"backgroundTag":"invalid-cli-argument","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}