{"record":{"id":"3d7a2f9b4dc5b45c","repo":"mono/mono","slug":"syntax-error-expected-debug-option-name","errorCode":null,"errorMessage":"Syntax error; expected debug option name\n","messagePattern":"Syntax error; expected debug option name\n","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"mono/mini/driver.c","lineNumber":208,"sourceCode":"\t\t\t\texit (1);\n\t\t\t}\n\t\t}\n\n\t\tg_free (arg);\n\t}\n\tg_free (parts);\n\n\treturn opt;\n}\n\nstatic gboolean\nparse_debug_options (const char* p)\n{\n\tMonoDebugOptions *opt = mini_get_debug_options ();\n\n\tdo {\n\t\tif (!*p) {\n\t\t\tfprintf (stderr, \"Syntax error; expected debug option name\\n\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!strncmp (p, \"casts\", 5)) {\n\t\t\topt->better_cast_details = TRUE;\n\t\t\tp += 5;\n\t\t} else if (!strncmp (p, \"mdb-optimizations\", 17)) {\n\t\t\topt->mdb_optimizations = TRUE;\n\t\t\tp += 17;\n\t\t} else if (!strncmp (p, \"gdb\", 3)) {\n\t\t\topt->gdb = TRUE;\n\t\t\tp += 3;\n\t\t} else {\n\t\t\tfprintf (stderr, \"Invalid debug option `%s', use --help-debug for details\\n\", p);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (*p == ',') {","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/mono/mono/blob/0f53e9e151d92944cacab3e24ac359410c606df6/mono/mini/driver.c#L190-L226","documentation":"Emitted by parse_debug_options at the very first iteration when the option string is empty (the loop's do { } encounters an empty string, i.e. *p == '\\0' immediately). It indicates the --debug= value parsed to nothing before any option name was read, and returns FALSE, which makes the option fall through to the 'Unsupported command line option' handler.","triggerScenarios":"Passing --debug= with an empty value, or --debug followed by a value that strips to empty. The parser expects at least one recognized token (casts, mdb-optimizations, gdb, ...).","commonSituations":"A shell variable expanding to empty in --debug=$DEBUG_OPTS; a stray equals sign; misconfigured debug option in a Docker entrypoint.","solutions":["Provide at least one valid debug option name, e.g. --debug=casts or --debug=gdb.","If DEBUG_OPTS may be empty, omit the flag entirely rather than passing --debug=.","Strip leading commas before passing the value."],"exampleFix":"# before\nDEBUG_OPTS=\"\"; mono --debug=$DEBUG_OPTS app.exe\n# after\nDEBUG_OPTS=\"casts\"; mono --debug=$DEBUG_OPTS app.exe","handlingStrategy":"validation","validationCode":"# Never pass an empty --debug= value\n[ -n \"$DEBUG_OPTS\" ] || unset DEBUG_OPTS\n[ -z \"${DEBUG_OPTS##,*}\" ] && DEBUG_OPTS=\"${DEBUG_OPTS#,}\"   # strip leading comma\nmono ${DEBUG_OPTS:+--debug=$DEBUG_OPTS} app.exe","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard env vars: only emit --debug= when the value is non-empty.","Strip leading/trailing commas from assembled option lists.","Unit-test argument-building in scripts with empty inputs."],"tags":["mono","cli","debug","argument-parsing","startup"],"backgroundTag":null,"analyzedSha":"0f53e9e151d92944cacab3e24ac359410c606df6","analyzedAt":"2026-08-13T18:54:37.190Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}