langchain-ai/deepagents · error · PluginManifestError

Invalid plugin name: {name!r}

Error message

Invalid plugin name: {name!r}

What it means

`_validate_name` checks that a plugin/marketplace name is a nonempty string with no whitespace (matching `_NAME_RE`), optionally forbidding `@` when `allow_at` is false, and falls back to a provided `fallback_name` (e.g. the directory name from the marketplace entry). If neither the value nor fallback is valid, it raises `PluginManifestError` with this message.

Source

Thrown at libs/code/deepagents_code/plugins/manifest.py:82

    the empty string are not.

    Returns:
        The validated name or fallback.

    Raises:
        PluginManifestError: If neither value is a valid name.
    """
    if (
        isinstance(name, str)
        and name
        and _NAME_RE.fullmatch(name)
        and (allow_at or "@" not in name)
    ):
        return name
    if fallback and _NAME_RE.fullmatch(fallback) and (allow_at or "@" not in fallback):
        return fallback
    msg = f"Invalid plugin name: {name!r}"
    raise PluginManifestError(msg)


def _is_windows_absolute(path: str) -> bool:
    return bool(PureWindowsPath(path).drive or PureWindowsPath(path).root)


def resolve_relative_path(
    declaration: str,
    plugin_root: Path,
    *,
    require_dot_prefix: bool = True,
) -> tuple[Path | None, str | None]:
    """Resolve one path declared relative to `plugin_root`.

    Plugin manifest component fields must start with `./`. Marketplace source
    paths must not, because the marketplace format also accepts a bare relative
    path such as `tools/my-plugin`; those callers pass
    `require_dot_prefix=False`. Both forms stay inside `plugin_root`.

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Set a valid `name` in the manifest: nonempty, no whitespace, matching the allowed charset (e.g. `code-review`).
  2. If relying on the fallback, ensure the marketplace entry/directory name is also a valid identifier.
  3. Keep `@` out of names except where the `name@marketplace` form is expected.
  4. Validate the manifest locally before publishing.

Example fix

// before
{"name": "Code Review"}
// after
{"name": "code-review"}
Defensive patterns

Strategy: validation

Validate before calling

import re
NAME_RE = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]*")
assert isinstance(name, str) and name and NAME_RE.fullmatch(name), f"bad name: {name!r}"

Type guard

def is_valid_plugin_name(name: object) -> bool:
    import re
    return (
        isinstance(name, str)
        and bool(name)
        and not any(c.isspace() for c in name)
        and name != "@"
    )

Try / catch

try:
    load_manifest(root, fallback_name=fallback)
except PluginManifestError as exc:
    if "Invalid plugin name" in str(exc):
        raise SystemExit(f"fix manifest name: {exc}") from exc

Prevention

When it happens

Trigger: `load_manifest` finds a manifest whose `name` field is missing, empty, not a string, contains whitespace, or fails `_NAME_RE` — and no valid `fallback_name` was passed (or the fallback itself is invalid); also via `_parse_entry` and `_load_marketplace_from_path` for marketplace entry/source names (where `allow_at=False`).

Common situations: Plugin author used a display-style name like `"Code Review"` in `plugin.json`; `name` omitted and the directory name is also invalid (spaces, empty); marketplace entry names containing `@` where it's disallowed; non-ASCII or punctuation-only names.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/7d9a3e59ee61bc7b. Report an issue: GitHub.