{"record":{"id":"f69f25f5f36a4848","repo":"BabylonJS/Babylon.js","slug":"runtask-is-not-implemented","errorCode":null,"errorMessage":"runTask is not implemented","messagePattern":"runTask is not implemented","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/Misc/assetsManager.ts","lineNumber":134,"sourceCode":"            scene,\r\n            () => {\r\n                this._onDoneCallback(onSuccess, onError);\r\n            },\r\n            (msg, exception) => {\r\n                this._onErrorCallback(onError, msg, exception);\r\n            }\r\n        );\r\n    }\r\n\r\n    /**\r\n     * Execute the current task\r\n     * @param scene defines the scene where you want your assets to be loaded\r\n     * @param onSuccess is a callback called when the task is successfully executed\r\n     * @param onError is a callback called if an error occurs\r\n     */\r\n    // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n    public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\r\n        throw new Error(\"runTask is not implemented\");\r\n    }\r\n\r\n    /**\r\n     * Reset will set the task state back to INIT, so the next load call of the assets manager will execute this task again.\r\n     * This can be used with failed tasks that have the reason for failure fixed.\r\n     */\r\n    public reset() {\r\n        this._taskState = AssetTaskState.INIT;\r\n    }\r\n\r\n    private _onErrorCallback(onError: (message?: string, exception?: any) => void, message?: string, exception?: any) {\r\n        this._taskState = AssetTaskState.ERROR;\r\n\r\n        this._errorObject = {\r\n            message: message,\r\n            exception: exception,\r\n        };\r\n\r","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/Misc/assetsManager.ts#L116-L152","documentation":"This is the abstract base-class implementation of AbstractAssetTask.runTask. The library throws it when a task is run that never overrode runTask, i.e. a custom or built-in task class forgot to implement the actual loading logic. AssetsManager calls runTask for each task when the AssetsManager.load()/processAsync runs.","triggerScenarios":"Calling AssetsManager.load()/run() with a task instance whose class does not override runTask — e.g. instantiating AbstractAssetTask (or a base task) directly, or a custom task subclass that overrides only onSuccess/onError but not runTask.","commonSituations":"Writing a custom asset task and forgetting to override runTask; refactoring that renamed the override so it no longer matches the signature; using a very old task class from a version whose runTask was renamed.","solutions":["Create a subclass and override runTask(scene, onSuccess, onError), calling onSuccess() on success or onError(message, exception) on failure","If you meant to use a built-in loader, instantiate the concrete task type (e.g. TextFileAssetTask, ImageAssetTask) instead of the abstract base","Check the override signature matches exactly: public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void)"],"exampleFix":"// before\nclass MyTask extends AbstractAssetTask {\n  // no runTask override\n}\n// after\nclass MyTask extends AbstractAssetTask {\n  public runTask(scene: Scene, onSuccess: () => void, onError: (message?: string, exception?: any) => void) {\n    try {\n      this._data = doLoad();\n      onSuccess();\n    } catch (e) {\n      onError('load failed', e);\n    }\n  }\n}","handlingStrategy":"validation","validationCode":"if (typeof (task as any).runTask !== 'function' || task.constructor === AbstractAssetTask) {\n  throw new TypeError('Task must be a concrete subclass that overrides runTask');\n}","typeGuard":"function hasRunTask(t: AbstractAssetTask): t is AbstractAssetTask & { runTask(scene: Scene, onSuccess: () => void, onError: (m?: string, e?: any) => void): void } {\n  return t.runTask !== AbstractAssetTask.prototype.runTask;\n}","tryCatchPattern":"try {\n  assetsManager.load();\n} catch (e) {\n  if (e instanceof Error && e.message === 'runTask is not implemented') {\n    console.error('Task class does not override runTask:', e);\n  }\n}","preventionTips":["Always subclass a concrete task type or override runTask in custom tasks","Use TypeScript abstract members so missing overrides fail at compile time","Add a unit test that runs every custom task through AssetsManager.load"],"tags":["abstract-class","unimplemented","assets-manager"],"backgroundTag":"unimplemented-abstract-method","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}