anthropics/skills · info · RuntimeError

This module should not be run directly.

Error message

This module should not be run directly.

What it means

docx.py is a library module of the office validators package with no standalone CLI; running it as __main__ trips the guard and raises RuntimeError. The validator logic (including its repair pass) is meant to be driven by an importing script.

Source

Thrown at skills/xlsx/scripts/office/validators/docx.py:466

                            pending.append(
                                f"  Repaired: {xml_file.name}: durableId {durable_id} → {new_id}"
                            )
                            modified = True

                if modified:
                    xml_file.write_bytes(dom.toxml(encoding="UTF-8"))
                    for message in pending:
                        print(message)
                    repairs += len(pending)

            except Exception:
                pass

        return repairs


if __name__ == "__main__":
    raise RuntimeError("This module should not be run directly.")

View on GitHub (pinned to f6656c1256)

Solutions

  1. Invoke the package's driver/entry script that imports office.validators.docx
  2. Import in a REPL for exploration instead of executing the file
  3. Exclude library modules from run-everything harnesses

Example fix

# before
python skills/xlsx/scripts/office/validators/docx.py
# after
python -c "import sys; sys.path.insert(0, 'skills/xlsx/scripts/office'); from validators import docx"  # import-only
Defensive patterns

Strategy: try-catch

Try / catch

# Not a runtime condition to catch — invoke the driver script instead of docx.py.

Prevention

When it happens

Trigger: `python skills/xlsx/scripts/office/validators/docx.py` from a shell, IDE run-file action, or a test harness that executes each file it discovers.

Common situations: Same as the other validators: IDE convenience runs, CI file-glob smoke tests, or assuming every .py in scripts/ has a main().

Related errors


AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14). Data as JSON: /api/errors/738179144afea618. Report an issue: GitHub.