{"record":{"id":"787b64eac0b9cd1a","repo":"flarum/framework","slug":"no-resource-or-endpoint-specified","errorCode":null,"errorMessage":"No resource or endpoint specified","messagePattern":"No resource or endpoint specified","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"framework/core/src/Api/JsonApi.php","lineNumber":52,"sourceCode":"\n    public function forResource(string $resourceClass): self\n    {\n        $this->resourceClass = $resourceClass;\n\n        return $this;\n    }\n\n    public function forEndpoint(string $endpointName): self\n    {\n        $this->endpointName = $endpointName;\n\n        return $this;\n    }\n\n    protected function makeContext(Request $request): Context\n    {\n        if (! $this->endpointName || ! $this->resourceClass || ! class_exists($this->resourceClass)) {\n            throw new BadRequestException('No resource or endpoint specified');\n        }\n\n        $collection = $this->getCollection($this->resourceClass);\n\n        return (new Context($this, $request))\n            ->withCollection($collection)\n            ->withEndpoint($this->findEndpoint($collection));\n    }\n\n    protected function findEndpoint(?Collection $collection): Endpoint\n    {\n        if (! $collection instanceof AbstractResource) {\n            throw new RuntimeException('Resource '.$collection::class.' must extend '.AbstractResource::class);\n        }\n\n        /** @var Endpoint $endpoint */\n        foreach ($collection->resolveEndpoints() as $endpoint) {\n            if ($endpoint->name === $this->endpointName) {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/framework/core/src/Api/JsonApi.php#L34-L70","documentation":"Configuration guard in JsonApi::makeContext: the JsonApi handler was instantiated without forResource()/forEndpoint() being called, or the given resourceClass does not exist, so no API context can be built for the request. Generic guard — the input at fault is the missing/invalid resourceClass or endpointName wiring.","triggerScenarios":"Thrown at framework/core/src/Api/JsonApi.php:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call forResource() with an existing resource class and/or forEndpoint() with a registered endpoint name before handling the request.","Verify the resource class string is spelled correctly and the class is autoloadable.","Check the service wiring/extension that constructs this JsonApi instance."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}