moeru-ai/airi · error · RuntimeError

Edge group is missing Mix or Map Range.001.

Error message

Edge group is missing Mix or Map Range.001.

What it means

Raised by the Blender export script (exportXiaoerEdgeReferenceStages.py:161) after it locates the compositor group node named '边缘光' (edge light) and inspects its internal node_tree: the group must contain two nodes with the exact Blender names 'Mix' and 'Map Range.001'. If either is missing the script aborts, because the downstream renders (reference_edge_mask.png via mask_node.outputs['Result'], and the edge compositing via mix_node.outputs['Result']) would KeyError on a non-existent node. This is a hard precondition on the source .blend file's internal node graph, not on runtime data.

Source

Thrown at engines/stage-tamagotchi-godot/tools/exportXiaoerEdgeReferenceStages.py:161

    bangs_node = find_group_node(main_tree, "刘海阴影")
    glow_node = find_group_node(main_tree, "辉光")

    def connect_final(socket):
        link_once(main_tree, socket, output_socket)
        if viewer is not None and len(viewer.inputs) > 0:
            link_once(main_tree, socket, viewer.inputs[0])

    def connect_edge_inputs():
        link_once(main_tree, render_layers.outputs["Image"], edge_node.inputs["Image"])
        link_once(main_tree, render_layers.outputs["Depth"], edge_node.inputs["深度"])
        link_once(main_tree, render_layers.outputs["法向"], edge_node.inputs["法向"])

    edge_group = edge_node.node_tree
    edge_output, edge_output_socket = ensure_group_output_socket(edge_group)
    mix_node = edge_group.nodes.get("Mix")
    mask_node = edge_group.nodes.get("Map Range.001")
    if mix_node is None or mask_node is None:
        raise RuntimeError("Edge group is missing Mix or Map Range.001.")

    def connect_edge_group_output(socket):
        link_once(edge_group, socket, edge_output_socket)

    # Raw render layer image.
    connect_final(render_layers.outputs["Image"])
    render_path(scene, output_dir / "reference_raw.png")

    # Edge node output before bangs shadow and glow.
    connect_edge_inputs()
    connect_edge_group_output(mix_node.outputs["Result"])
    connect_final(edge_node.outputs[0])
    render_path(scene, output_dir / "reference_after_edge.png")

    # Internal edge mask: Map Range.001.Result before Mix.
    connect_edge_group_output(mask_node.outputs["Result"])
    connect_final(edge_node.outputs[0])
    render_path(scene, output_dir / "reference_edge_mask.png")

View on GitHub (pinned to 27111382b4)

Solutions

  1. Open the .blend file in Blender, edit the '边缘光' compositor group, and ensure there is a node literally named 'Mix' and another literally named 'Map Range.001' (rename in the N-panel / Item tab if Blender auto-suffixed them).
  2. If the shader intentionally uses different node names, update the two lookups in exportXiaoerEdgeReferenceStages.py:158-159 (edge_group.nodes.get('Mix') / get('Map Range.001')) to match the real node names, and verify the output sockets ('Result') still exist on those nodes.
  3. Re-create the missing 'Map Range.001' node inside the group and rewire it so the mask render path (mask_node.outputs['Result']) produces the intended edge mask.
  4. Confirm you are running the script against the canonical source .blend the tool was written for, not a re-exported/merged copy.

Example fix

# before: the group was renamed so the lookups return None
mix_node = edge_group.nodes.get("Mix")         # None
mask_node = edge_group.nodes.get("Map Range.001") # None
# -> Edge group is missing Mix or Map Range.001.

# after: align the script with the real node names in the .blend
mix_node = edge_group.nodes.get("Mix.001") or edge_group.nodes.get("Mix")
mask_node = edge_group.nodes.get("Map Range")
if mix_node is None or mask_node is None:
    raise RuntimeError("Edge group is missing Mix or Map Range.")
Defensive patterns

Strategy: validation

Validate before calling

# Before relying on the node names, assert the group has the nodes the script needs.
mix_node = edge_group.nodes.get("Mix")
mask_node = edge_group.nodes.get("Map Range.001")
missing = [n for n, found in (("Mix", mix_node), ("Map Range.001", mask_node)) if found is None]
if missing:
    raise RuntimeError(f"Edge group is missing node(s): {', '.join(missing)}. "
                       f"Available nodes: {[n.name for n in edge_group.nodes]}")

Prevention

When it happens

Trigger: The '边缘光' group in the .blend file was edited: someone renamed 'Mix' or 'Map Range.001', deleted the Map Range.001 node, or duplicated the group and Blender renumbered the auto-name to 'Map Range.002'; the script is being run against a different/newer .blend file whose edge group layout no longer matches the export tool's expectations; the node was merged into another node and the second Map Range that the script expects no longer exists.

Common situations: An artist reworked the edge-light shader and renamed nodes for clarity; a .blend was imported/appended from another file and Blender deduplicated names (applying '.001' suffix to a different node); the export tool was updated to expect 'Map Range.001' but the source file still only has 'Map Range'; running the tool on a stripped/exported .blend where the group internals were collapsed.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/1398c7ce932f2536. Report an issue: GitHub.