{"record":{"id":"dd7912ea3cf578bf","repo":"seaweedfs/seaweedfs","slug":"parent-pid-d-is-invalid","errorCode":null,"errorMessage":"parent PID %d is invalid","messagePattern":"parent PID (.+?) is invalid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"weed/command/fuse_std.go","lineNumber":115,"sourceCode":"\t}\n\n\t// get residual option data\n\tif option.Len() > 0 {\n\t\t// add value to pending option\n\t\toptions = append(options, parameter{option.String(), \"true\"})\n\t\toption.Reset()\n\t}\n\n\t// scan each parameter\n\tfor i := 0; i < len(options); i++ {\n\t\tparameter := options[i]\n\n\t\tswitch parameter.name {\n\t\tcase \"child\":\n\t\t\tmasterProcess = false\n\t\t\tif parsed, err := strconv.ParseInt(parameter.value, 10, 64); err == nil {\n\t\t\t\tif parsed > math.MaxInt || parsed <= 0 {\n\t\t\t\t\tpanic(fmt.Errorf(\"parent PID %d is invalid\", parsed))\n\t\t\t\t}\n\t\t\t\tmountOptions.fuseCommandPid = int(parsed)\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Errorf(\"parent PID %s is invalid: %w\", parameter.value, err))\n\t\t\t}\n\t\tcase \"arg0\":\n\t\t\tmountOptions.dir = &parameter.value\n\t\tcase \"filer\":\n\t\t\tmountOptions.filer = &parameter.value\n\t\tcase \"filer.path\":\n\t\t\tmountOptions.filerMountRootPath = &parameter.value\n\t\tcase \"dirAutoCreate\":\n\t\t\tif parsed, err := strconv.ParseBool(parameter.value); err == nil {\n\t\t\t\tmountOptions.dirAutoCreate = &parsed\n\t\t\t} else {\n\t\t\t\tpanic(fmt.Errorf(\"dirAutoCreate: %s\", err))\n\t\t\t}\n\t\tcase \"collection\":","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/seaweedfs/seaweedfs/blob/1c926e8fac8e8001ce25efa1027c90b02b4a1804/weed/command/fuse_std.go#L97-L133","documentation":"The `child=<pid>` option marks this weed process as the child half of the FUSE daemonization pair: the master re-execs the weed binary with `-o child=<master PID>` appended (fuse_std.go:311). The value parses as a 64-bit decimal int, then this panic fires when it is <= 0 or exceeds math.MaxInt. The normal producer is strconv.Itoa(os.Getpid()), which can never emit such a value, so hitting this means the child= option was hand-crafted, copied, or corrupted.","triggerScenarios":"Invoking the fuse helper with an explicit `-o child=0` or `-o child=-5`; a 32-bit weed build receiving child=2500000000 (> MaxInt32); scripts that rebuild the master argv and mangle the PID field.","commonSituations":"Manually re-running the child command copied from `ps` output; systemd/wrapper units that rewrite argv; shell quoting bugs that truncate the value to 0.","solutions":["Remove `-o child=...` entirely - the master process appends it automatically when spawning the child","If you must simulate a child, pass a live positive decimal PID such as `-o child=1234`","Prefer `weed mount -dir=... -filer=...` which mounts directly and skips the master/child re-exec path","On 32-bit builds, confirm the PID fits in int32 (kernel pid_max caps at 4194304, so this is normally automatic)"],"exampleFix":"// before\nweed fuse /mnt/sw -o \"filer=localhost:8888,child=0\"\n\n// after\nweed fuse /mnt/sw -o \"filer=localhost:8888\"\n// child=<master pid> is appended automatically by the master process","handlingStrategy":"validation","validationCode":"# bash: reject bogus child= values before invoking the helper\nif [[ \"$opts\" =~ child=([^ ,]*) ]]; then\n  pid=\"${BASH_REMATCH[1]}\"\n  [[ \"$pid\" =~ ^[1-9][0-9]*$ ]] || { echo \"bad child pid: $pid\" >&2; exit 1; }\nfi","typeGuard":"func isValidChildPid(v string) bool {\n\tparsed, err := strconv.ParseInt(v, 10, 64)\n\treturn err == nil && parsed > 0 && parsed <= int64(math.MaxInt)\n}","tryCatchPattern":null,"preventionTips":["Never pass child= yourself; it is an internal option generated by the master process","When testing the child path, take the PID from the live master, not from stale ps output","Validate generated command lines in wrappers before exec"],"tags":["fuse","mount","pid","process-management","validation"],"backgroundTag":null,"analyzedSha":"1c926e8fac8e8001ce25efa1027c90b02b4a1804","analyzedAt":"2026-08-15T15:37:02.018Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}