hasura/graphql-engine · error

plugin should be named %q, not %q

Error message

plugin should be named %q, not %q

What it means

ValidatePlugin verifies that the name recorded inside the plugin manifest (p.Name) matches the name argument the caller supplied. A mismatch means the manifest declares one name but was loaded/registered under another, which would break later name-based lookups and binary naming.

Source

Thrown at cli/plugins/types.go:133

}

// ValidatePlugin checks for structural validity of the Plugin object with given
// name.
func (p Plugin) ValidatePlugin(name string) error {
	var op errors.Op = "plugins.Plugin.ValidatePlugin"
	if !IsSafePluginName(name) {
		return errors.E(
			op,
			fmt.Errorf(
				"the plugin name %q is not allowed, must match %q",
				name,
				safePluginRegexp.String(),
			),
		)
	}

	if p.Name != name {
		return errors.E(op, fmt.Errorf("plugin should be named %q, not %q", name, p.Name))
	}

	if p.ShortDescription == "" {
		return errors.E(op, "should have a short description")
	}

	if strings.ContainsAny(p.ShortDescription, "\r\n") {
		return errors.E(op, "should not have line breaks in short description")
	}

	if len(p.Platforms) == 0 {
		return errors.E(op, "should have a platform specified")
	}

	if p.Version == "" {
		return errors.E(op, "should have a version specified")
	}

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Make the manifest's "name" field exactly equal the name passed to ReadPluginFromFile (case-sensitive).
  2. If the manifest name is correct, fix the name argument/file name you are loading with.
  3. Re-validate after editing with ValidatePlugin before shipping.

Example fix

// before
// file: foo.json  { "name": "bar", ... }
p.ReadPluginFromFile("foo")

// after
// file: foo.json  { "name": "foo", ... }
p.ReadPluginFromFile("foo")
Defensive patterns

Strategy: validation

Validate before calling

data, _ := os.ReadFile(path)
var probe struct{ Name string `json:"name"` }
if err := json.Unmarshal(data, &probe); err != nil {
	return err
}
if probe.Name != name {
	return fmt.Errorf("manifest name %q != requested %q; fix manifest or name", probe.Name, name)
}

Try / catch

if err := p.ValidatePlugin(name); err != nil {
	if strings.Contains(err.Error(), "plugin should be named") {
		// reconcile name argument with manifest "name" field, then retry
	}
}

Prevention

When it happens

Trigger: Calling ReadPluginFromFile(name, ...) where the JSON manifest's "name" field differs from the name argument — e.g. loading a file named foo.json whose manifest says "name": "bar".

Common situations: Copying an existing plugin manifest and forgetting to update the name field; renaming the manifest file but not its contents; case mismatches between filename and manifest name.

Related errors


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