{"record":{"id":"ffbc2c4548241cf6","repo":"mudler/LocalAI","slug":"ds4-worker-s","errorCode":null,"errorMessage":"ds4-worker: %s\n","messagePattern":"ds4-worker: (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/cpp/ds4/worker_main.c","lineNumber":75,"sourceCode":"\n    for (int i = 1; i < argc; i++) {\n        const char *arg = argv[i];\n        if (!strcmp(arg, \"-h\") || !strcmp(arg, \"--help\")) {\n            fprintf(stdout, \"ds4-worker: standalone ds4 distributed worker\\n\");\n            ds4_dist_usage(stdout);\n            fprintf(stdout, \"  -m, --model PATH   model GGUF (the worker loads only its --layers slice)\\n\");\n            fprintf(stdout, \"  -c, --ctx N        context size (default 32768)\\n\");\n            fprintf(stdout, \"  -t, --threads N    CPU threads\\n\");\n            fprintf(stdout, \"  --cpu|--cuda|--metal  backend override\\n\");\n            return 0;\n        }\n\n        char dist_err[256] = {0};\n        ds4_dist_cli_parse_result dist_parse =\n            ds4_dist_parse_cli_arg(arg, &i, argc, argv, &opt.distributed,\n                                   dist_err, sizeof(dist_err));\n        if (dist_parse == DS4_DIST_CLI_ERROR) {\n            fprintf(stderr, \"ds4-worker: %s\\n\",\n                    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 {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/cpp/ds4/worker_main.c#L57-L93","documentation":"Passthrough for distributed-option parsing failures in ds4-worker's main loop: each unrecognized arg is first offered to ds4_dist_parse_cli_arg(); if it returns DS4_DIST_CLI_ERROR the worker prints ds4-worker: <dist_err> (or a generic 'invalid distributed option' when the buffer is empty) and returns exit status 2. The specific reason (bad --role value, malformed --layers slice, invalid host:port for rendezvous) comes from the distributed parser itself.","triggerScenarios":"Running 'ds4-worker --role driver' (invalid role), '--layers foo', or a malformed distributed address argument — ds4_dist_parse_cli_arg fills dist_err and returns ERROR, and the loop exits 2 before the role/model checks.","commonSituations":"Confusing worker vs launcher flags; version skew where the local ds4 build's parser rejects a newer flag; typos in host:port endpoints of the distributed group; passing driver-only options to a worker.","solutions":["Read the dist_err text — it names the exact distributed option problem; fix that token and re-run.","Run 'ds4-worker --help' to list accepted distributed flags for this build.","Confirm role spelling ('--role worker') and endpoint formats match the launcher's expectations.","If the flag should exist, rebuild/upgrade ds4 so worker and library parsers agree."],"exampleFix":"# before\nds4-worker --role drivr --layers 0-8 -m model.gguf\n# -> ds4-worker: invalid role 'drivr'\n\n# after\nds4-worker --role worker --layers 0-8 -m model.gguf","handlingStrategy":"validation","validationCode":"# validate role/layers before launching workers\n[ \"$ROLE\" = \"worker\" ] || { echo \"ds4-worker only accepts --role worker\" >&2; exit 2; }\ncase \"$LAYERS\" in *[!0-9-]*|'') echo \"bad --layers: $LAYERS\" >&2; exit 2;; esac","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate distributed argv from the launcher tool that already knows valid roles/slices instead of hand-writing them.","Keep worker and library in the same ds4 build so the CLI parser accepts the same flag set.","Treat any 'ds4-worker: <text>' line followed by exit 2 as a fixable argv problem — correct it rather than retrying."],"tags":["c","ds4","cli","distributed","validation"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}