{"record":{"id":"738179144afea618","repo":"anthropics/skills","slug":"this-module-should-not-be-run-directly-738179","errorCode":null,"errorMessage":"This module should not be run directly.","messagePattern":"This module should not be run directly\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"info","filePath":"skills/xlsx/scripts/office/validators/docx.py","lineNumber":466,"sourceCode":"                            pending.append(\n                                f\"  Repaired: {xml_file.name}: durableId {durable_id} → {new_id}\"\n                            )\n                            modified = True\n\n                if modified:\n                    xml_file.write_bytes(dom.toxml(encoding=\"UTF-8\"))\n                    for message in pending:\n                        print(message)\n                    repairs += len(pending)\n\n            except Exception:\n                pass\n\n        return repairs\n\n\nif __name__ == \"__main__\":\n    raise RuntimeError(\"This module should not be run directly.\")\n","sourceCodeStart":448,"sourceCodeEnd":467,"githubUrl":"https://github.com/anthropics/skills/blob/f6656c1256d5a8adfa37db9110046ef20bac644c/skills/xlsx/scripts/office/validators/docx.py#L448-L467","documentation":"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.","triggerScenarios":"`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.","commonSituations":"Same as the other validators: IDE convenience runs, CI file-glob smoke tests, or assuming every .py in scripts/ has a main().","solutions":["Invoke the package's driver/entry script that imports office.validators.docx","Import in a REPL for exploration instead of executing the file","Exclude library modules from run-everything harnesses"],"exampleFix":"# before\npython skills/xlsx/scripts/office/validators/docx.py\n# after\npython -c \"import sys; sys.path.insert(0, 'skills/xlsx/scripts/office'); from validators import docx\"  # import-only","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"# Not a runtime condition to catch — invoke the driver script instead of docx.py.","preventionTips":["Use the entry-point script that imports validators.docx","Avoid 'run every .py' patterns in CI and IDE tooling"],"tags":["module-guard","usage-error","python"],"backgroundTag":null,"analyzedSha":"f6656c1256d5a8adfa37db9110046ef20bac644c","analyzedAt":"2026-08-14T16:09:17.493Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}