{"record":{"id":"111deae499c9480e","repo":"mudler/LocalAI","slug":"ds4-worker-unknown-option-s","errorCode":null,"errorMessage":"ds4-worker: unknown option: %s\n","messagePattern":"ds4-worker: unknown option: (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/cpp/ds4/worker_main.c","lineNumber":94,"sourceCode":"                    dist_err[0] ? dist_err : \"invalid distributed option\");\n            return 2;\n        }\n        if (dist_parse == DS4_DIST_CLI_MATCHED) continue;\n\n        if (!strcmp(arg, \"-m\") || !strcmp(arg, \"--model\")) {\n            opt.model_path = need_arg(&i, argc, argv, arg);\n        } else if (!strcmp(arg, \"-c\") || !strcmp(arg, \"--ctx\")) {\n            ctx_size = parse_int_arg(need_arg(&i, argc, argv, arg), arg);\n        } else if (!strcmp(arg, \"-t\") || !strcmp(arg, \"--threads\")) {\n            opt.n_threads = parse_int_arg(need_arg(&i, argc, argv, arg), arg);\n        } else if (!strcmp(arg, \"--cpu\")) {\n            opt.backend = DS4_BACKEND_CPU;\n        } else if (!strcmp(arg, \"--cuda\")) {\n            opt.backend = DS4_BACKEND_CUDA;\n        } else if (!strcmp(arg, \"--metal\")) {\n            opt.backend = DS4_BACKEND_METAL;\n        } else {\n            fprintf(stderr, \"ds4-worker: unknown option: %s\\n\", arg);\n            return 2;\n        }\n    }\n\n    if (opt.distributed.role != DS4_DISTRIBUTED_WORKER) {\n        fprintf(stderr, \"ds4-worker: --role worker is required\\n\");\n        return 2;\n    }\n    if (!opt.model_path) {\n        fprintf(stderr, \"ds4-worker: --model is required\\n\");\n        return 2;\n    }\n\n    char prep_err[256] = {0};\n    if (ds4_dist_prepare_engine_options(&opt.distributed, &opt,\n                                        prep_err, sizeof(prep_err)) != 0) {\n        fprintf(stderr, \"ds4-worker: %s\\n\", prep_err);\n        return 2;","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/cpp/ds4/worker_main.c#L76-L112","documentation":"ds4-worker's argument fallthrough: after -m/-c/-t/--cpu/--cuda/--metal and the distributed parser all decline to match, the token is unknown and the worker prints it and exits 2. This catches misspelled flags and flags belonging to other binaries before any model load.","triggerScenarios":"'ds4-worker --model-path x.gguf' (should be --model), '--thread 8' (should be --threads), or passing launcher/orchestrator flags like --master to a build whose distributed parser does not know them.","commonSituations":"Copy-pasting flags from the main ds4 server or a different backend; long/short confusion (-model vs -m); flag renamed between versions.","solutions":["Correct the flag: -m/--model PATH, -c/--ctx N, -t/--threads N, --cpu|--cuda|--metal, plus the distributed set shown by --help.","Run ds4-worker --help to dump the accepted grammar for this build and diff it against your script.","Remove flags intended for other processes from the worker's argv (pass them to the right binary instead)."],"exampleFix":"# before\nds4-worker --role worker --model-path /m.gguf\n\n# after\nds4-worker --role worker --model /m.gguf","handlingStrategy":"validation","validationCode":"# whitelist accepted flags in the launcher\nALLOW='-m --model -c --ctx -t --threads --cpu --cuda --metal --role --layers'\nfor a in \"$@\"; do case \" $ALLOW \" in *\" $a \"*) ;; *) echo \"unknown option: $a\" >&2; exit 2;; esac; done","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy worker argv from 'ds4-worker --help' output for this build rather than from another backend's docs.","Prefer the short forms (-m, -c, -t) which are stable across versions.","Version-pin ds4 so flag sets in scripts and binary stay in sync."],"tags":["c","ds4","cli","usage-error"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}