phalcon/cphalcon · error · Phalcon\Forms\Exceptions\FormNotRegistered

There is no form with name='{name}'

Error message

There is no form with name='{name}'

What it means

Phalcon\Forms\Manager::get() fetches a form previously stored under a name via create() or set(); it does a strict fetch on the internal forms map and throws FormNotRegistered when no form was stored under that key.

Source

Thrown at phalcon/Forms/Manager.zep:69

    public function create(string name, entity = null) -> <Form>
    {
        var form;

        let form = new Form(entity),
            this->forms[name] = form;

        return form;
    }

    /**
     * Returns a form by its name
     */
    public function get(string name) -> <Form>
    {
        var form;

        if unlikely !fetch form, this->forms[name] {
            throw new FormNotRegistered(name);
        }

        return form;
    }

    /**
     * Returns the FormsLocator instance.
     */
    public function getLocator() -> <FormsLocator>
    {
        return this->locator;
    }

    /**
     * Checks if a form is registered in the forms manager
     */
    public function has(string name) -> bool
    {

View on GitHub (pinned to b7419de9cd)

Solutions

  1. Register the form before fetching: $this->forms->set('checkout', new CheckoutForm())
  2. Guard the lookup: if ($manager->has('checkout')) { $form = $manager->get('checkout'); }
  3. Centralize form names as class constants used by both the creator and the consumer

Example fix

// before
$form = $this->forms->get('checkout'); // never created

// after
$this->forms->set('checkout', new CheckoutForm());
$form = $this->forms->get('checkout');
Defensive patterns

Strategy: validation

Validate before calling

if ($manager->has($name)) {
    $form = $manager->get($name);
} else {
    $form = new DefaultForm();
    $manager->set($name, $form);
}

Try / catch

try {
    $form = $manager->get($name);
} catch (\Phalcon\Forms\Exceptions\FormNotRegistered $e) {
    // lazily build and register the form on first access
    $form = new DefaultForm();
    $manager->set($name, $form);
}

Prevention

When it happens

Trigger: Calling $manager->get('checkout') before $manager->create('checkout', new CheckoutForm()) or $manager->set('checkout', $form) ran; a typo or case difference between the registration key and the lookup key.

Common situations: Multi-step flows where the form is created in one controller action and fetched in another but the name drifted; a shared Manager service used across modules with inconsistent key naming; register and lookup done in different case styles.

Related errors


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/f32b6956bd4d2f9d. Report an issue: GitHub.