{"record":{"id":"8b8bc59a776ab5f7","repo":"juicedata/juicefs","slug":"load-worker-config-s","errorCode":null,"errorMessage":"load worker config: %s","messagePattern":"load worker config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/sync.go","lineNumber":537,"sourceCode":"\t\treturn \"\", \"\", err\n\t}\n\tfor key, value := range env {\n\t\tif err := os.Setenv(key, value); err != nil {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"set worker environment %q: %s\", key, err)\n\t\t}\n\t}\n\treturn src, dst, nil\n}\n\nfunc doSync(c *cli.Context) error {\n\tisWorker := c.String(\"manager\") != \"\"\n\tvar workerSrcURL, workerDstURL string\n\tif isWorker {\n\t\tvar err error\n\t\t// need init before NewConfigFromCli, otherwise the env will not be applied(umask)\n\t\tworkerSrcURL, workerDstURL, err = loadClusterWorkerConfig(os.Stdin)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"load worker config: %s\", err)\n\t\t}\n\t}\n\tsetup(c, 2)\n\tif c.IsSet(\"include\") && !c.IsSet(\"exclude\") {\n\t\tlogger.Warnf(\"The include option needs to be used with the exclude option, otherwise the result of the current sync may not match your expectations\")\n\t}\n\tconfig := sync.NewConfigFromCli(c)\n\tcliCtx = c\n\tif config.Manager != \"\" {\n\t\tlogger.Debugf(\"worker process start\")\n\t}\n\t// Windows support `\\` and `/` as its separator, Unix only use `/`\n\tsrcURL, dstURL := c.Args().Get(0), c.Args().Get(1)\n\tif isWorker {\n\t\tsrcURL, dstURL = workerSrcURL, workerDstURL\n\t} else {\n\t\tconfig.SetClusterStorage(srcURL, dstURL)\n\t}","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/sync.go#L519-L555","documentation":"In doSync, when the process runs as a sync worker (--worker), it reads its src/dst URLs and environment from the master via loadClusterWorkerConfig(os.Stdin). Any failure in that handshake (including bad config format, I/O errors on stdin, or env-setting failures from error 310) is re-wrapped as 'load worker config: %s'. The worker cannot proceed without this config, so the command exits.","triggerScenarios":"`juicefs sync ... --worker` where loadClusterWorkerConfig returns an error: stdin closed/empty, malformed cluster config line, or a setenv failure inside the worker env application loop.","commonSituations":"Worker launched without the master piping the config into stdin; master crashed or disconnected mid-handshake; master sent malformed config; stdin redirected by a process manager (systemd/docker) so the worker never receives the config.","solutions":["Read the inner error after 'load worker config:' to find the root cause.","Verify the worker was launched by the master (with --worker) so stdin carries the cluster config; do not run --worker manually with a terminal stdin.","Check that the master is running and reachable, and that it printed no errors when distributing the job.","If running under a supervisor, ensure stdin is a pipe connected to the master, not /dev/null."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runSyncWorker(); err != nil {\n    if strings.Contains(err.Error(), \"load worker config\") {\n        // verify master connectivity and that stdin carries the config pipe\n    }\n    return err\n}","preventionTips":["Always launch workers through the master (with --worker), never manually with a terminal stdin","Under systemd/docker, ensure stdin is wired to the master process, not /dev/null","Log master-side errors when distributing cluster jobs"],"tags":["sync","worker","cli","ipc"],"backgroundTag":"missing-required-config","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}