phalcon/cphalcon · error · Phalcon\Mvc\Model\Query\Exceptions\EmptyArrayPlaceholderValue

At least one value must be bound in placeholder

Error message

At least one value must be bound in placeholder: {name}

What it means

Thrown when the value bound to an array-type placeholder (array/array-str/array-int) is an empty array; expanding zero values into an IN (...) list would produce invalid SQL, so the query refuses to prepare.

Solutions

  1. Check count($values) > 0 before executing the query and skip or rewrite the query when empty.
  2. Remove the IN condition from the PHQL when the value list is empty.
  3. Bind a sentinel value that matches no rows if an empty result is acceptable.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Mvc/Model/Query.zep:2185 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at phalcon/Mvc/Model/Query.zep:2185

                                    "type":  "placeholder",
                                    "value": ":" . name
                                ];

                                break;

                            case "array":
                            case "array-str":
                            case "array-int":
                                if unlikely !fetch bind, this->bindParams[name] {
                                    throw new BindValueRequired(name);
                                }

                                if unlikely typeof bind != "array" {
                                    throw new BindTypeRequiresArray(name);
                                }

                                if unlikely empty bind {
                                    throw new EmptyArrayPlaceholderValue(name);
                                }

                                let exprReturn = [
                                    "type":     "placeholder",
                                    "value":    ":" . name,
                                    "rawValue": name,
                                    "times":    count(bind)
                                ];

                                break;

                            default:
                                throw new UnknownBindType(bindType);
                        }
                    } else {
                        let exprReturn = [
                            "type":  "placeholder",
                            "value": ":" . value

View on GitHub (pinned to b7419de9cd)