3b1b/manim · error

Invalid scene name

Error message

Invalid scene name

What it means

Same interactive scene-selection path as error 55, but for the name branch: a non-numeric token is looked up in name_to_class (built from each scene class's __name__). An unknown name raises KeyError, caught and logged as 'Invalid scene name', then exit status 2.

Source

Thrown at manimlib/extract_scene.py:57

def prompt_user_for_choice(scene_classes):
    name_to_class = {}
    max_digits = len(str(len(scene_classes)))
    for idx, scene_class in enumerate(scene_classes, start=1):
        name = scene_class.__name__
        print(f"{str(idx).zfill(max_digits)}: {name}")
        name_to_class[name] = scene_class
    try:
        user_input = input("\nSelect which scene to render (by name or number): ")
        return [
            name_to_class[split_str] if not split_str.isnumeric() else scene_classes[int(split_str) - 1]
            for split_str in user_input.replace(" ", "").split(",")
        ]
    except IndexError:
        log.error("Invalid scene number")
        sys.exit(2)
    except KeyError:
        log.error("Invalid scene name")
        sys.exit(2)
    except EOFError:
        sys.exit(1)


def compute_total_frames(scene_class, scene_config):
    """
    When a scene is being written to file, a copy of the scene is run with
    skip_animations set to true so as to count how many frames it will require.
    This allows for a total progress bar on rendering, and also allows runtime
    errors to be exposed preemptively for long running scenes.
    """
    pre_config = copy.deepcopy(scene_config)
    pre_config["file_writer_config"]["write_to_movie"] = False
    pre_config["file_writer_config"]["save_last_frame"] = False
    pre_config["file_writer_config"]["quiet"] = True
    pre_config["skip_animations"] = True
    pre_scene = scene_class(**pre_config)

View on GitHub (pinned to dee01804d4)

Solutions

  1. Type the exact scene class name as printed in the menu (case-sensitive)
  2. Copy-paste the name from the numbered list shown above the prompt
  3. Run with -a/--write_all or name the scene on the CLI to avoid interactive selection

Example fix

# before
> construct   # class is actually named Construct
# after
> Construct
Defensive patterns

Strategy: validation

Validate before calling

name = input("Scene name: ")
assert name in {c.__name__ for c in scene_classes}, f"{name!r} is not a scene class name"

Type guard

def is_known_scene_name(name: str, classes: list) -> bool:
    return name in {c.__name__ for c in classes}

Prevention

When it happens

Trigger: Typing a class name with a typo ('MyScnee'), using the file name instead of the class name, wrong casing ('myscene' vs 'MyScene'), or pasting a name of a class that exists in a different file.

Common situations: Forgetting the scene class is named Construct not the file name; renaming a class but reusing an old shell command; case-sensitivity surprises.

Related errors


AI-assisted analysis of 3b1b/manim@dee01804d4 (2026-08-14). Data as JSON: /api/errors/61ad769ed7af6150. Report an issue: GitHub.