t8y2/dbx · error

read %s %s: %w

Error message

read %s %s: %w

What it means

requireRegularFile wraps the os.Stat error when the configured path cannot be inspected — the file does not exist, the path has a bad component, or permission is denied. The %w wrap preserves the underlying *PathError so you can see the OS reason (no such file or directory, permission denied, etc.).

Source

Thrown at agents/drivers/cassandra-go/kerberos.go:619

	}
	return ""
}

func firstPathListEntry(value string) string {
	entries := filepath.SplitList(value)
	if len(entries) == 0 {
		return value
	}
	return entries[0]
}

func requireRegularFile(label, path string) error {
	if path == "" {
		return fmt.Errorf("%s path is empty", label)
	}
	info, err := os.Stat(path)
	if err != nil {
		return fmt.Errorf("read %s %s: %w", label, path, err)
	}
	if !info.Mode().IsRegular() {
		return fmt.Errorf("%s is not a regular file: %s", label, path)
	}
	return nil
}

func firstNonEmpty(values ...string) string {
	for _, value := range values {
		if value != "" {
			return value
		}
	}
	return ""
}

View on GitHub (pinned to c0390bff16)

Solutions

  1. Read the wrapped OS error to see whether it is 'no such file or directory' or 'permission denied' and fix accordingly.
  2. Verify the path with ls -l <path> as the same user the driver runs as.
  3. Create or regenerate the missing file (kinit, ktutil, mount the secret volume).
  4. Fix filesystem permissions (chown/chmod) so the service account can read the file.

Example fix

// before
path: /etc/krb5.keytab (file only readable by root; driver runs as cassandra)
// after
$ chown cassandra:cassandra /etc/krb5.keytab && chmod 640 /etc/krb5.keytab
Defensive patterns

Strategy: validation

Validate before calling

if path != "" {
    if _, err := os.Stat(path); err != nil {
        return fmt.Errorf("precheck: cannot stat %s: %w", path, err)
    }
}

Try / catch

var pathErr *fs.PathError
if errors.As(err, &pathErr) && errors.Is(pathErr.Err, fs.ErrNotExist) {
    // regenerate or fix the configured path
}

Prevention

When it happens

Trigger: finalize/selectCCacheCredential/selectKeytabCredential call requireRegularFile and os.Stat(path) returns an error: nonexistent file, dangling symlink, missing parent directory, or a path the process cannot traverse.

Common situations: Typo in the keytab or ccache path; file mounted into a container at a different location; running as a non-root service account that cannot read /etc/krb5.keytab; SELinux/AppArmor blocking access; a kinit-produced ccache deleted between setting KRB5CCNAME and connecting.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/bdb7d70776df13b1. Report an issue: GitHub.