matryer/xbar · error

ReadAll

Error message

ReadAll

What it means

LoadVariableValues (pkg/plugins/variables.go:45-47) wraps io.ReadAll failures with 'ReadAll'. After the file opens successfully, reading up to 1MB can still fail on underlying I/O errors (bad sectors, interrupted read on network mounts). The wrapped OS error is reported as 'ReadAll: <os error>'.

Source

Thrown at pkg/plugins/variables.go:47

	}
	return nil
}

// LoadVariableValues loads the variables for a plugin.
func LoadVariableValues(pluginDir, installedPluginPath string) (map[string]interface{}, error) {
	filename := filepath.Join(pluginDir, installedPluginPath+variableJSONFileExt)
	f, err := os.Open(filename)
	if err != nil {
		if os.IsNotExist(err) {
			// no file - but not an error, just empty map
			return map[string]interface{}{}, nil
		}
		return nil, errors.Wrap(err, "Open")
	}
	defer f.Close()
	b, err := io.ReadAll(io.LimitReader(f, 1_000_000 /* ~1MB */))
	if err != nil {
		return nil, errors.Wrap(err, "ReadAll")
	}
	var values map[string]interface{}
	err = json.Unmarshal(b, &values)
	if err != nil {
		return nil, errors.Wrap(err, "json.Unmarshal")
	}
	return values, nil
}

func (p *Plugin) loadVariablesAsEnvVars() ([]string, error) {
	vars, err := p.loadVariables()
	if err != nil {
		return nil, errors.Wrap(err, "loadVariables")
	}
	envvars := make([]string, 0, len(vars))
	for k, v := range vars {
		envvars = append(envvars, fmt.Sprintf("%s=%v", k, v))
	}

View on GitHub (pinned to d624239058)

Solutions

  1. Retry LoadVariableValues after checking the mount/filesystem health.
  2. Run filesystem checks (fsck) if I/O errors persist on local disks.
  3. Move the plugin directory onto a local disk instead of a network share.
  4. Check dmesg/system logs for the underlying I/O error to identify hardware vs. network causes.
Defensive patterns

Strategy: retry

Validate before calling

path := filepath.Join(pluginDir, installedPluginPath+".vars.json")
if f, err := os.Open(path); err == nil {
	defer f.Close()
	if _, err := f.Read(make([]byte, 1)); err != nil {
		log.Printf("vars file unreadable (io): %v", err)
	}
}

Try / catch

var values map[string]interface{}
for attempt := 0; attempt < 3; attempt++ {
	values, err = plugins.LoadVariableValues(pluginDir, installedPluginPath)
	if err == nil {
		break
	}
	if strings.Contains(err.Error(), "ReadAll") {
		time.Sleep(time.Duration(attempt+1) * 100 * time.Millisecond)
		continue
	}
	return err
}

Prevention

When it happens

Trigger: Reading the .vars.json file from a network volume that drops mid-read; hardware/disk I/O error; file truncated or locked by another process during read.

Common situations: Plugin directory on NFS/SMB that times out; failing disk; container volume unmounted while xbar runs.

Related errors


AI-assisted analysis of matryer/xbar@d624239058 (2026-09-02). Data as JSON: /api/errors/0a9958c4bf340bf5. Report an issue: GitHub.