mudler/LocalAI · error

ds4-worker: %s

Error message

ds4-worker: %s

What it means

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.

Source

Thrown at backend/cpp/ds4/worker_main.c:75

    for (int i = 1; i < argc; i++) {
        const char *arg = argv[i];
        if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) {
            fprintf(stdout, "ds4-worker: standalone ds4 distributed worker\n");
            ds4_dist_usage(stdout);
            fprintf(stdout, "  -m, --model PATH   model GGUF (the worker loads only its --layers slice)\n");
            fprintf(stdout, "  -c, --ctx N        context size (default 32768)\n");
            fprintf(stdout, "  -t, --threads N    CPU threads\n");
            fprintf(stdout, "  --cpu|--cuda|--metal  backend override\n");
            return 0;
        }

        char dist_err[256] = {0};
        ds4_dist_cli_parse_result dist_parse =
            ds4_dist_parse_cli_arg(arg, &i, argc, argv, &opt.distributed,
                                   dist_err, sizeof(dist_err));
        if (dist_parse == DS4_DIST_CLI_ERROR) {
            fprintf(stderr, "ds4-worker: %s\n",
                    dist_err[0] ? dist_err : "invalid distributed option");
            return 2;
        }
        if (dist_parse == DS4_DIST_CLI_MATCHED) continue;

        if (!strcmp(arg, "-m") || !strcmp(arg, "--model")) {
            opt.model_path = need_arg(&i, argc, argv, arg);
        } else if (!strcmp(arg, "-c") || !strcmp(arg, "--ctx")) {
            ctx_size = parse_int_arg(need_arg(&i, argc, argv, arg), arg);
        } else if (!strcmp(arg, "-t") || !strcmp(arg, "--threads")) {
            opt.n_threads = parse_int_arg(need_arg(&i, argc, argv, arg), arg);
        } else if (!strcmp(arg, "--cpu")) {
            opt.backend = DS4_BACKEND_CPU;
        } else if (!strcmp(arg, "--cuda")) {
            opt.backend = DS4_BACKEND_CUDA;
        } else if (!strcmp(arg, "--metal")) {
            opt.backend = DS4_BACKEND_METAL;
        } else {

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Read the dist_err text — it names the exact distributed option problem; fix that token and re-run.
  2. Run 'ds4-worker --help' to list accepted distributed flags for this build.
  3. Confirm role spelling ('--role worker') and endpoint formats match the launcher's expectations.
  4. If the flag should exist, rebuild/upgrade ds4 so worker and library parsers agree.

Example fix

# before
ds4-worker --role drivr --layers 0-8 -m model.gguf
# -> ds4-worker: invalid role 'drivr'

# after
ds4-worker --role worker --layers 0-8 -m model.gguf
Defensive patterns

Strategy: validation

Validate before calling

# validate role/layers before launching workers
[ "$ROLE" = "worker" ] || { echo "ds4-worker only accepts --role worker" >&2; exit 2; }
case "$LAYERS" in *[!0-9-]*|'') echo "bad --layers: $LAYERS" >&2; exit 2;; esac

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of mudler/LocalAI@44413a9d06 (2026-08-15). Data as JSON: /api/errors/ffbc2c4548241cf6. Report an issue: GitHub.