{"record":{"id":"3022e3a90432e3a9","repo":"octobercms/october","slug":"form-record-with-an-id-of-id-could-not-be-found-3022e3","errorCode":null,"errorMessage":"Form record with an ID of :id could not be found.","messagePattern":"Form record with an ID of :id could not be found\\.","errorType":"exception","errorClass":"ApplicationException","httpStatus":null,"severity":"error","filePath":"modules/tailor/controllers/Entries.php","lineNumber":727,"sourceCode":"            $model = $model->withSites();\n        }\n\n        if ($this->isVersionMode()) {\n            $model = $model->withVersions();\n        }\n\n        if ($this->isDraftMode()) {\n            $model = $model->withDrafts();\n        }\n        else {\n            $model = $model->withSavedDrafts();\n        }\n\n        // Include deleted records\n        $model = $model->withTrashed()->find($recordId);\n\n        if (!$model) {\n            throw new ApplicationException(__(\"Form record with an ID of :id could not be found.\", [\n                'class' => $this->modelInstance::class, 'id' => $recordId\n            ]));\n        }\n\n        // Mimic parent method\n        $this->formExtendModel($model);\n\n        return $model;\n    }\n\n    /**\n     * formGetRedirectUrl\n     */\n    public function formGetRedirectUrl($context = null, $model = null): string\n    {\n        if (post('close') || $this->isSectionSingular() || $context === 'delete') {\n            $url = 'tailor/entries/'.$this->activeSource->handleSlug;\n        }","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/tailor/controllers/Entries.php#L709-L745","documentation":"Thrown by the Tailor Entries controller (formFindModelObject) when the requested record ID cannot be found in the database, even after including soft-deleted records via withTrashed(). It surfaces as an ApplicationException, meaning it produces a user-facing error page or AJAX error response rather than a system crash.","triggerScenarios":"Opening /backend/tailor/entries/update/{id} (or an AJAX handler like onSave, onCommitDraft, onRestore) with an ID that no longer exists; the record was hard-deleted in another tab or by another user; the URL was bookmarked with a stale ID; the record belongs to a different site in a multisite setup and is filtered out.","commonSituations":"Stale browser tab after the record was deleted elsewhere; double-submit after a delete; copied links to removed entries; multisite deployments where the record exists only on another site node; draft-mode URL quirks where the draft record id differs from the published record id.","solutions":["Verify the record exists: check the listing in the Tailor backend section, or run php artisan tinker and query the entry table for that ID","If the URL is stale (old bookmark, reopened tab), navigate back to the section list and open the record fresh","In multisite setups, switch to the site node the record belongs to before editing it","If records were deleted by a migration or import, restore the data or remove the outdated link"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before linking to an entry, confirm it exists (including trashed)\n$exists = \\Tailor\\Models\\EntryRecord::inSection('blog_post')\n    ->withTrashed()\n    ->whereKey($recordId)\n    ->exists();\nif (!$exists) {\n    // skip rendering / redirect to list\n}","typeGuard":null,"tryCatchPattern":"try {\n    $model = $controller->formFindModelObject($recordId);\n} catch (\\ApplicationException $e) {\n    // Record was deleted elsewhere: redirect to the section list with a flash message\n    return \\Redirect::to(backend_url('tailor/entries/' . $sectionHandle))->withFlashError($e->getMessage());\n}","preventionTips":["Handle deleted-record ApplicationExceptions in custom backend controllers with a redirect to the listing","Avoid persisting deep links to specific entry IDs; link via the section listing instead","In multisite setups, verify the current site node matches the record's site before opening edit pages"],"tags":["tailor","octobercms","controller","record-not-found","backend","application-exception"],"backgroundTag":"record-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}