hasura/graphql-engine · error

write plugin receipt %q: %w

Error message

write plugin receipt %q: %w

What it means

After successfully marshaling the plugin manifest to YAML, StoreManifest fails to write the bytes to the destination path (the plugin receipt file) with os.WriteFile. The error wraps the OS-level failure, so the message includes the exact destination path.

Source

Thrown at cli/plugins/plugins.go:481

	plugin, err := c.ReadPluginFromFile(path)
	if err != nil {
		return plugin, errors.E(op, err)
	}

	return plugin, nil
}

func (c *Config) StoreManifest(plugin Plugin, dest string) error {
	var op errors.Op = "plugins.Config.StoreManifest"

	yamlBytes, err := yaml.Marshal(plugin)
	if err != nil {
		return errors.E(op, fmt.Errorf("convert to yaml: %w", err))
	}

	err = os.WriteFile(dest, yamlBytes, 0o644)
	if err != nil {
		return errors.E(op, fmt.Errorf("write plugin receipt %q: %w", dest, err))
	}

	return nil
}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Ensure the parent directory of the receipt path exists (mkdir -p the plugins index dir) and is writable by the current user
  2. Fix ownership: sudo chown -R $(whoami) on the CLI plugins index directory
  3. Free disk space or remount the filesystem read-write, then retry install/upgrade

Example fix

# before
mycli plugin install my-plugin
# Error: write plugin receipt "/root/.mycli/plugins/index/my-plugin.yaml": permission denied

# after
mkdir -p ~/.mycli/plugins/index
sudo chown -R $(whoami) ~/.mycli/plugins
mycli plugin install my-plugin
Defensive patterns

Strategy: try-catch

Validate before calling

if dir := filepath.Dir(dest); err := os.MkdirAll(dir, 0o755); err != nil { return err }
if f, err := os.OpenFile(dest, os.O_WRONLY|os.O_CREATE, 0o644); err != nil { return err } ; f.Close()

Try / catch

err := cfg.StoreManifest(p, dest)
if err != nil {
	var perr *fs.PathError
	if errors.As(err, &perr) && os.IsPermission(perr) {
		// fix ownership/permissions, then retry once
	}
}

Prevention

When it happens

Trigger: Calling Config.Install or Config.Upgrade when dest (the receipt path, e.g. under IndexPluginsPath) is in a non-existent directory, is read-only, is owned by another user, or when the disk is full.

Common situations: Plugins index directory was deleted or never created; running the CLI under sudo previously so receipt files are root-owned; read-only filesystem such as a container image or NixOS store; ENOSPC.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/97f655436bec5f5b. Report an issue: GitHub.