Products published via ayon_publish_model appear in the AYON Loader UI (Houdini etc.), but loading fails with "Failed to load items" / InvalidRepresentationContext.
Root cause (verified 2026-07-16 by executing the real loader code path headless)
ayon_core resolves the file path like this (pipeline/load/utils.py::get_representation_path, core 1.9.1):
The Loader does NOT use attrib.path or files[].path for resolution. It formats attrib.template with the representation's data.context dict. MCP-created representations have data = {} → KeyError: 'context' → InvalidRepresentationContext → "Failed to load items".
This was the final blocker in the quercus_oak publish (tie_fighter): after template and file naming were already correct, loading still failed until data.context was patched in.
Required fix
create_representation must write a full context block into data.context, matching what Pyblish/Integrate produces:
Every key referenced by attrib.template must exist in the context (hierarchy, folder[name], product[type], product[name], project[name], project[code], version, ext). root is overridden by Anatomy at load time.
Verification recipe (no DCC needed)
importsys,ossys.path.insert(0,"/opt/AYON-1.5.4-linux-rocky9/dependencies")sys.path.insert(0,os.path.expanduser("~/.local/share/AYON/dependency_packages/<pkg>/dependencies"))sys.path.insert(0,os.path.expanduser("~/.local/share/AYON/addons/core_1.9.1"))fromayon_core.pipeline.load.utilsimportget_representation_context,get_representation_path_from_contextctx=get_representation_context(project,rep_id)print(get_representation_path_from_context(ctx))# must resolve + exist
Env: AYON_SERVER_URL, AYON_API_KEY, AYON_BUNDLE_NAME (production bundle from GET /api/bundles).
Relation to other issues
Extends #2: even with metadata-only publishing, the metadata itself was incomplete — attrib.template (already documented) anddata.context (this issue) are both mandatory for loadability.
## Symptom
Products published via `ayon_publish_model` appear in the AYON Loader UI (Houdini etc.), but loading fails with **"Failed to load items"** / `InvalidRepresentationContext`.
## Root cause (verified 2026-07-16 by executing the real loader code path headless)
`ayon_core` resolves the file path like this (`pipeline/load/utils.py::get_representation_path`, core 1.9.1):
```python
template = repre_entity["attrib"]["template"]
context = copy.deepcopy(repre_entity["context"]) # ← representation data.context!
context["root"] = anatomy.roots
path = StringTemplate.format_strict_template(template, context)
```
The Loader does **NOT** use `attrib.path` or `files[].path` for resolution. It formats `attrib.template` with the representation's **`data.context`** dict. MCP-created representations have `data = {}` → `KeyError: 'context'` → `InvalidRepresentationContext` → "Failed to load items".
This was the final blocker in the quercus_oak publish (tie_fighter): after template and file naming were already correct, loading still failed until `data.context` was patched in.
## Required fix
`create_representation` must write a full context block into `data.context`, matching what Pyblish/Integrate produces:
```json
{"data": {"context": {
"asset": "<folder name>",
"ext": "fbx",
"family": "<product type>",
"folder": {"name": "…", "parents": ["assets", "plants"], "path": "/assets/plants/…", "type": "Asset"},
"hierarchy": "assets/plants",
"product": {"name": "…", "type": "modelMain"},
"project": {"code": "tie", "name": "tie_fighter"},
"representation": "fbx",
"root": {"work": "…"},
"subset": "<product name>",
"user": {"name": "…"}, "username": "…",
"version": 1
}}}
```
Every key referenced by `attrib.template` must exist in the context (`hierarchy`, `folder[name]`, `product[type]`, `product[name]`, `project[name]`, `project[code]`, `version`, `ext`). `root` is overridden by Anatomy at load time.
## Verification recipe (no DCC needed)
```python
import sys, os
sys.path.insert(0, "/opt/AYON-1.5.4-linux-rocky9/dependencies")
sys.path.insert(0, os.path.expanduser("~/.local/share/AYON/dependency_packages/<pkg>/dependencies"))
sys.path.insert(0, os.path.expanduser("~/.local/share/AYON/addons/core_1.9.1"))
from ayon_core.pipeline.load.utils import get_representation_context, get_representation_path_from_context
ctx = get_representation_context(project, rep_id)
print(get_representation_path_from_context(ctx)) # must resolve + exist
```
Env: `AYON_SERVER_URL`, `AYON_API_KEY`, `AYON_BUNDLE_NAME` (production bundle from `GET /api/bundles`).
## Relation to other issues
- Extends #2: even with metadata-only publishing, the metadata itself was incomplete — `attrib.template` (already documented) **and** `data.context` (this issue) are both mandatory for loadability.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Symptom
Products published via
ayon_publish_modelappear in the AYON Loader UI (Houdini etc.), but loading fails with "Failed to load items" /InvalidRepresentationContext.Root cause (verified 2026-07-16 by executing the real loader code path headless)
ayon_coreresolves the file path like this (pipeline/load/utils.py::get_representation_path, core 1.9.1):The Loader does NOT use
attrib.pathorfiles[].pathfor resolution. It formatsattrib.templatewith the representation'sdata.contextdict. MCP-created representations havedata = {}→KeyError: 'context'→InvalidRepresentationContext→ "Failed to load items".This was the final blocker in the quercus_oak publish (tie_fighter): after template and file naming were already correct, loading still failed until
data.contextwas patched in.Required fix
create_representationmust write a full context block intodata.context, matching what Pyblish/Integrate produces:Every key referenced by
attrib.templatemust exist in the context (hierarchy,folder[name],product[type],product[name],project[name],project[code],version,ext).rootis overridden by Anatomy at load time.Verification recipe (no DCC needed)
Env:
AYON_SERVER_URL,AYON_API_KEY,AYON_BUNDLE_NAME(production bundle fromGET /api/bundles).Relation to other issues
attrib.template(already documented) anddata.context(this issue) are both mandatory for loadability.