octobercms/october · error · ApplicationException

Missing code

Error message

Missing code

What it means

Error "Missing code" thrown in octobercms/october.

Source

Thrown at modules/backend/controllers/Files.php:161

    public static function getUniqueCode($file)
    {
        if (!$file) {
            return null;
        }

        $hash = md5($file->file_name . '!' . $file->disk_name);
        return base64_encode($file->id . '!' . $hash);
    }

    /**
     * findFileObject locates a file model based on the unique code.
     * @param $code string
     * @return System\Models\File
     */
    protected function findFileObject($code)
    {
        if (!$code) {
            throw new ApplicationException('Missing code');
        }

        $parts = explode('!', base64_decode($code));
        if (count($parts) < 2) {
            throw new ApplicationException('Invalid code');
        }

        [$id, $hash] = $parts;

        if (!$file = FileModel::find((int) $id)) {
            throw new ApplicationException('File not found');
        }

        // Ensure that the file model utilized for this request is
        // the one specified in the relationship configuration
        if ($file->attachment) {
            $fileModel = $file->attachment->{$file->field}()->getRelated();

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/controllers/Files.php:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/2955396310f44ffe. Report an issue: GitHub.