FoundationAgents/MetaGPT · warning · NotImplementedError

Not implement: {node.value}

Error message

Not implement: {node.value}

What it means

RepoParser._parse_expr handles only three AST expression shapes: ast.Constant, ast.Call, and ast.Tuple. Any other node.value type (e.g. BinOp, Name at value position, ListComp) hits the explicit NotImplementedError. This is a parser coverage limit, not a user config error.

Source

Thrown at metagpt/repo_parser.py:604

    def _parse_expr(node) -> List:
        """
        Parses an expression Abstract Syntax Tree (AST) node.

        Args:
            node: The AST node representing an expression.

        Returns:
            List: A list containing the parsed information from the expression node.
        """
        funcs = {
            any_to_str(ast.Constant): lambda x: [any_to_str(x.value), RepoParser._parse_variable(x.value)],
            any_to_str(ast.Call): lambda x: [any_to_str(x.value), RepoParser._parse_variable(x.value.func)],
            any_to_str(ast.Tuple): lambda x: [any_to_str(x.value), RepoParser._parse_variable(x.value)],
        }
        func = funcs.get(any_to_str(node.value))
        if func:
            return func(node)
        raise NotImplementedError(f"Not implement: {node.value}")

    @staticmethod
    def _parse_name(n):
        """
        Gets the 'name' value of an Abstract Syntax Tree (AST) node.

        Args:
            n: The AST node.

        Returns:
            The 'name' value of the AST node.
        """
        if n.asname:
            return f"{n.name} as {n.asname}"
        return n.name

    @staticmethod
    def _parse_if(n):

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. Wrap or limit parsing to the files you control, excluding the file with the unsupported expression
  2. Extend the funcs dict in _parse_expr with a lambda for the offending node type returning a list
  3. Report/upgrade MetaGPT — newer parsers may cover more expression types

Example fix

// before
MAX = 1024 * 1024  # ast.BinOp -> NotImplementedError when parsed

// after
MAX = 1048576  # ast.Constant is supported
Defensive patterns

Strategy: fallback

Type guard

import ast

SUPPORTED_EXPRS = (ast.Constant, ast.Call, ast.Tuple)

def expr_is_supported(node) -> bool:
    return isinstance(getattr(node, "value", None), SUPPORTED_EXPRS)

Try / catch

try:
    parsed = RepoParser._parse_expr(node)
except NotImplementedError:
    parsed = [str(type(node.value).__name__), None]  # degrade gracefully, keep scanning

Prevention

When it happens

Trigger: RepoParser walks module-level or class-level assignments whose RHS is an unsupported expression, e.g. SIZE = 1024 * 1024 (ast.BinOp) or NAMES = [n for n in x] (ast.ListComp), while extracting code blocks.

Common situations: Parsing dependencies of arbitrary Python projects during generate_dependencies / class-view generation; expression-heavy config modules; codebases using comprehensions or arithmetic at module level.

Related errors


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/5976e664aa72682a. Report an issue: GitHub.