calesthio/OpenMontage · critical · FileNotFoundError

Missing Three.js world templates

Error message

Missing Three.js world templates: {', '.join(missing)}

What it means

Raised by the Three.js world builder when one or more of the bundled runtime templates — index.html, world.css, world-runtime.js — are missing from tools/graphics/templates/threejs_world/ next to threejs_world.py. These templates are the generated world's scaffold; without them the workspace cannot be assembled, so the tool fails fast with the exact missing names.

Solutions

  1. Check the exception message for the exact missing file names
  2. Restore/reinstall the package so tools/graphics/templates/threejs_world/ contains all three files
  3. If packaging, ensure non-Python data files are included (package_data / MANIFEST.in)
  4. Verify with: ls tools/graphics/templates/threejs_world/

Example fix

# pyproject.toml (before: templates excluded)
# after
[tool.setuptools.package-data]
"tools.graphics" = ["templates/threejs_world/*"]
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
required = ["index.html", "world.css", "world-runtime.js"]
tdir = Path(tool_dir) / "templates" / "threejs_world"
missing = [n for n in required if not (tdir / n).is_file()]
assert not missing, f"templates missing: {missing}"

Prevention

When it happens

Trigger: Partial install or packaging of OpenMontage that shipped threejs_world.py but not its templates directory; templates deleted or moved during a refactor; running from a copied source tree that skipped non-Python files.

Common situations: pip install from a broken sdist/wheel; Docker image built with .dockerignore excluding template dirs; git sparse-checkout missing those paths.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/16b566f7c885b3e7. Report an issue: GitHub.

Appendix: source

Thrown at tools/graphics/threejs_world.py:645

    @staticmethod
    def _write_workspace(
        *,
        workspace: Path,
        spec: dict[str, Any],
        report: dict[str, Any],
        duration: float,
        width: int,
        height: int,
        render_mode: str,
        quality_tier: str,
        catalog_paths: list[Path],
    ) -> list[str]:
        template_dir = Path(__file__).resolve().parent / "templates" / "threejs_world"
        required = ["index.html", "world.css", "world-runtime.js"]
        missing = [name for name in required if not (template_dir / name).is_file()]
        if missing:
            raise FileNotFoundError(f"Missing Three.js world templates: {', '.join(missing)}")

        workspace.mkdir(parents=True, exist_ok=True)
        (workspace / "assets").mkdir(exist_ok=True)
        (workspace / "renders").mkdir(exist_ok=True)

        catalog_index: dict[str, Any] = {"version": "1.0", "catalogs": []}
        model_root = workspace / "assets" / "models"
        model_root.mkdir(parents=True, exist_ok=True)
        for catalog_path in catalog_paths:
            manifest_path = catalog_path / "catalog-manifest.json"
            manifest = json.loads(manifest_path.read_text(encoding="utf-8"))
            catalog_id = str(manifest["catalog_id"])
            target = model_root / catalog_id
            source = catalog_path / "source"
            if target.exists():
                shutil.rmtree(target)
            shutil.copytree(source, target)
            copied = copy.deepcopy(manifest)

View on GitHub (pinned to 95e1c3d0ab)