{"record":{"id":"905305c812ee6408","repo":"mrdoob/three.js","slug":"three-objectloader-can-t-load-url","errorCode":null,"errorMessage":"THREE.ObjectLoader: Can't load ${url}","messagePattern":"THREE\\.ObjectLoader: Can't load (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/loaders/ObjectLoader.js","lineNumber":191,"sourceCode":"\t\tconst text = await loader.loadAsync( url, onProgress );\n\n\t\tlet json;\n\n\t\ttry {\n\n\t\t\tjson = JSON.parse( text );\n\n\t\t} catch ( e ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t parse ' + url + '. ' + e.message );\n\n\t\t}\n\n\t\tconst metadata = json.metadata;\n\n\t\tif ( metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry' ) {\n\n\t\t\tthrow new Error( 'THREE.ObjectLoader: Can\\'t load ' + url );\n\n\t\t}\n\n\t\treturn await scope.parseAsync( json );\n\n\t}\n\n\t/**\n\t * Parses the given JSON. This is used internally by {@link ObjectLoader#load}\n\t * but can also be used directly to parse a previously loaded JSON structure.\n\t *\n\t * @param {Object} json - The serialized 3D object.\n\t * @param {onLoad} onLoad - Executed when all resources (e.g. textures) have been fully loaded.\n\t * @return {Object3D} The parsed 3D object.\n\t */\n\tparse( json, onLoad ) {\n\n\t\tconst animations = this.parseAnimations( json.animations );","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/loaders/ObjectLoader.js#L173-L209","documentation":"Thrown by ObjectLoader after successful JSON parse when the parsed object is not a loadable three.js scene/object: either json.metadata is undefined, metadata.type is undefined, or metadata.type (lowercased) equals 'geometry'. Legacy standalone geometry files from older three.js revisions are explicitly rejected; ObjectLoader only handles objects/scenes.","triggerScenarios":"Loading a legacy three.js Geometry JSON export (metadata.type === 'geometry'), a JSON that is valid but not a three.js export (missing metadata), or a partial/hand-built JSON lacking the metadata block. Also loading an output from BufferGeometry.toJSON() directly rather than a Mesh/Scene.toJSON().","commonSituations":"Migrating old projects that saved geometry JSON. Loading a plain data JSON mistaken for a scene. Loading a geometry-only file produced by older exporters. Hand-authoring JSON without the metadata header.","solutions":["Ensure the file was produced by object.toJSON() or scene.toJSON() so it contains metadata.type === 'Object' or 'Scene'.","For legacy geometry JSON, parse it with the appropriate legacy path or convert it: wrap it in a Mesh first, then export via scene.toJSON().","Load geometry-only files separately (e.g. with BufferGeometryLoader) and build the mesh yourself.","Open the JSON and confirm metadata.type is 'Object' or 'Scene', not 'geometry' or missing."],"exampleFix":"// before: loading a legacy geometry.json (metadata.type === 'geometry')\nobjectLoader.load('old-geometry.json', onLoad); // throws 'Can't load'\n\n// after: use the geometry loader, then wrap in a mesh\nconst geoLoader = new THREE.BufferGeometryLoader();\ngeoLoader.load('old-geometry.json', (geo) => {\n  const mesh = new THREE.Mesh(geo, new THREE.MeshStandardMaterial());\n  scene.add(mesh);\n});","handlingStrategy":"validation","validationCode":"function isLoadableObjectJSON(json) {\n  const meta = json && json.metadata;\n  if (!meta || meta.type === undefined) return false;\n  const t = String(meta.type).toLowerCase();\n  return t !== 'geometry';\n}\n\nconst json = JSON.parse(text);\nif (!isLoadableObjectJSON(json)) {\n  throw new Error(`${url} is not a loadable three.js Object/Scene JSON`);\n}","typeGuard":"function isSceneOrObjectJSON(json) {\n  const type = json && json.metadata && json.metadata.type;\n  return typeof type === 'string'\n    && ['object', 'scene'].includes(type.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Produce load files via scene.toJSON()/object.toJSON() so metadata.type is set.","Use BufferGeometryLoader for legacy geometry-only JSON.","Inspect metadata.type before handing JSON to ObjectLoader."],"tags":["threejs","loader","objectloader","metadata","legacy-geometry","serialization"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}