mudler/LocalAI · error

ds4-worker: --model is required

Error message

ds4-worker: --model is required

What it means

Second post-parse invariant in ds4-worker: opt.model_path must be set (the worker loads only its --layers slice of the GGUF, but it still needs the file). Missing -m/--model exits with status 2 before engine open.

Source

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

            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 {
            fprintf(stderr, "ds4-worker: unknown option: %s\n", arg);
            return 2;
        }
    }

    if (opt.distributed.role != DS4_DISTRIBUTED_WORKER) {
        fprintf(stderr, "ds4-worker: --role worker is required\n");
        return 2;
    }
    if (!opt.model_path) {
        fprintf(stderr, "ds4-worker: --model is required\n");
        return 2;
    }

    char prep_err[256] = {0};
    if (ds4_dist_prepare_engine_options(&opt.distributed, &opt,
                                        prep_err, sizeof(prep_err)) != 0) {
        fprintf(stderr, "ds4-worker: %s\n", prep_err);
        return 2;
    }

    ds4_engine *engine = NULL;
    if (ds4_engine_open(&engine, &opt) != 0 || !engine) {
        fprintf(stderr, "ds4-worker: failed to open engine\n");
        return 1;
    }

    ds4_dist_generation_options gen = {0};
    gen.ctx_size = ctx_size;

View on GitHub (pinned to 44413a9d06)

Solutions

  1. Pass '-m /path/to/model.gguf' pointing at a file readable by this worker.
  2. Verify the path exists on THIS node (shared volume mounted) before launch: test -f "$MODEL".
  3. Parameterize the model path in your launcher so every worker replica receives it.

Example fix

# before
ds4-worker --role worker --layers 8

# after
ds4-worker --role worker --layers 8 -m /shared/ds4.gguf
Defensive patterns

Strategy: validation

Validate before calling

# launcher invariant: model file must exist and be non-empty before exec
[ -n "$MODEL" ] && [ -f "$MODEL" ] && [ -s "$MODEL" ] || { echo "--model path missing/empty: $MODEL" >&2; exit 2; }
exec ds4-worker --role worker -m "$MODEL" "$@"

Prevention

When it happens

Trigger: 'ds4-worker --role worker --layers 8' with no -m; or -m consumed by a typo'd variant like --model-path (which instead triggers unknown-option).

Common situations: Distributed templates where each worker gets host/port/layers env-vars but the model path variable is empty; shared-storage assumptions (model on NFS only on some nodes).

Related errors


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