seaweedfs/seaweedfs · error

parent PID %s is invalid: %w

Error message

parent PID %s is invalid: %w

What it means

Same child= handling as above, but here strconv.ParseInt(value, 10, 64) itself failed, and the wrapped error names the exact cause: invalid syntax (empty string, letters, a unit suffix like 's') or the value overflowing int64. The child process aborts at startup before any FUSE handshake happens.

Source

Thrown at weed/command/fuse_std.go:119

		// add value to pending option
		options = append(options, parameter{option.String(), "true"})
		option.Reset()
	}

	// scan each parameter
	for i := 0; i < len(options); i++ {
		parameter := options[i]

		switch parameter.name {
		case "child":
			masterProcess = false
			if parsed, err := strconv.ParseInt(parameter.value, 10, 64); err == nil {
				if parsed > math.MaxInt || parsed <= 0 {
					panic(fmt.Errorf("parent PID %d is invalid", parsed))
				}
				mountOptions.fuseCommandPid = int(parsed)
			} else {
				panic(fmt.Errorf("parent PID %s is invalid: %w", parameter.value, err))
			}
		case "arg0":
			mountOptions.dir = &parameter.value
		case "filer":
			mountOptions.filer = &parameter.value
		case "filer.path":
			mountOptions.filerMountRootPath = &parameter.value
		case "dirAutoCreate":
			if parsed, err := strconv.ParseBool(parameter.value); err == nil {
				mountOptions.dirAutoCreate = &parsed
			} else {
				panic(fmt.Errorf("dirAutoCreate: %s", err))
			}
		case "collection":
			mountOptions.collection = &parameter.value
		case "replication":
			mountOptions.replication = &parameter.value
		case "disk":

View on GitHub (pinned to 1c926e8fac)

Solutions

  1. Drop child= from your invocation - the master generates it automatically
  2. If simulating a child, pass a plain decimal PID with no sign, suffix, or whitespace
  3. For fstab entries, check option quoting so the value is not split on spaces/commas or emptied
  4. Print the exact option string before running to catch truncation

Example fix

// before
weed fuse /mnt/sw -o "filer=localhost:8888,child=self"

// after
weed fuse /mnt/sw -o "filer=localhost:8888"
// run the master and let it spawn: weed fuse /mnt/sw -o filer=localhost:8888
Defensive patterns

Strategy: validation

Validate before calling

func validateChildOption(v string) error {
	parsed, err := strconv.ParseInt(v, 10, 64)
	if err != nil {
		return fmt.Errorf("child must be a decimal PID: %w", err)
	}
	if parsed <= 0 || parsed > int64(math.MaxInt) {
		return fmt.Errorf("child PID %d out of range", parsed)
	}
	return nil
}

Type guard

func isValidChildPid(v string) bool {
	parsed, err := strconv.ParseInt(v, 10, 64)
	return err == nil && parsed > 0 && parsed <= int64(math.MaxInt)
}

Prevention

When it happens

Trigger: -o child= (empty value); -o child=abc; -o child=1234s; child=99999999999999999999 (> int64 range); fstab quoting that splits or empties the value.

Common situations: Hand-editing mount option strings while debugging; fstab/systemd units where quoting swallows the value; truncated copy-paste of the master's argv.

Related errors


AI-assisted analysis of seaweedfs/seaweedfs@1c926e8fac (2026-08-15). Data as JSON: /api/errors/2e49ab788104be33. Report an issue: GitHub.