getgrav/grav · error · RuntimeException

Bad identifier type %s

Error message

Bad identifier type %s

What it means

Error "Bad identifier type %s" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Framework/Relationships/Traits/RelationshipTrait.php:109

        if ($min || $max) {
            $count = $this->count();
            if ($min && $count < $min) {
                throw new RuntimeException(sprintf('%s relationship has too few objects in it', $this->name));
            }
            if ($max && $count > $max) {
                throw new RuntimeException(sprintf('%s relationship has too many objects in it', $this->name));
            }
        }
    }

    /**
     * @param IdentifierInterface $identifier
     * @return IdentifierInterface
     */
    private function checkIdentifier(IdentifierInterface $identifier): IdentifierInterface
    {
        if ($this->type !== $identifier->getType()) {
            throw new RuntimeException(sprintf('Bad identifier type %s', $identifier->getType()));
        }

        if ($identifier::class !== Identifier::class) {
            return $identifier;
        }

        if ($this->type === 'media') {
            return new MediaIdentifier($identifier->getId());
        }

        return new FlexIdentifier($identifier->getId(), $identifier->getType());
    }

    private function parseOptions(array $options): void
    {
        $this->type = $options['type'];
        $this->options = $options;
    }

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Framework/Relationships/Traits/RelationshipTrait.php:109 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/8abcc0467dd88cca. Report an issue: GitHub.