# Buggy code
def _create_begin(
    self,
    schema: s_schema.Schema,
    context: sd.CommandContext,
) -> s_schema.Schema:
    referrer_ctx = self.get_referrer_context(context)
    if referrer_ctx is None:
        return super()._create_begin(schema, context)

    subject = referrer_ctx.scls
    assert isinstance(subject, ConsistencySubject)
    if not subject.can_accept_constraints(schema):
        raise errors.UnsupportedFeatureError(
            f"constraints cannot be defined on {subject.get_verbosename(schema)}",
            context=self.source_context,
        )

    if not context.canonical:
        props = self.get_resolved_attributes(schema, context)
        props.pop("name")
        props.pop("subject", None)
        fullname = self.classname
        shortname = sn.shortname_from_fullname(fullname)
        constr_base, attrs, inh = Constraint.get_concrete_constraint_attrs(
            schema, subject, name=shortname, sourcectx=self.source_context, **props
        )

        for k, v in attrs.items():
            inherited = inh.get(k)
            self.set_attribute_value(k, v, inherited=bool(inherited))

        self.set_attribute_value("subject", subject)

    return super()._create_begin(schema, context)


# Traceback (AttributeError)
db> CREATE ABSTRACT CONSTRAINT `🚀🍿` EXTENDING max_len_value;
OK: CREATE
db> CREATE SCALAR TYPE foo EXTENDING str {
...     CREATE CONSTRAINT `🚀🍿`(10);
... };
ERROR: InternalServerError: 'NoneType' object has no attribute 'get_parameter_name'
Hint: This is most likely a bug in EdgeDB. Please consider opening an issue ticket at https://github.com/edgedb/edgedb/issues/new?template=bug_report.md
Server traceback:
Traceback (most recent call last):
File "/home/victor/dev/magicstack/edgedb/edb/server/procpool/worker.py", line 75, in worker
res = await meth(*args)
File "/home/victor/dev/magicstack/edgedb/edb/server/compiler/compiler.py", line 1480, in compile_eql_tokens
return self._compile(ctx=ctx, tokens=eql_tokens)
File "/home/victor/dev/magicstack/edgedb/edb/server/compiler/compiler.py", line 1141, in _compile
comp: dbstate.BaseQuery = self._compile_dispatch_ql(ctx, stmt)
File "/home/victor/dev/magicstack/edgedb/edb/server/compiler/compiler.py", line 1076, in _compile_dispatch_ql
return self._compile_ql_ddl(ctx, ql)
File "/home/victor/dev/magicstack/edgedb/edb/server/compiler/compiler.py", line 763, in _compile_ql_ddl
cmd = s_ddl.delta_from_ddl(
File "/home/victor/dev/magicstack/edgedb/edb/schema/ddl.py", line 466, in delta_from_ddl
_, cmd = _delta_from_ddl(ddl_stmt, schema=schema, modaliases=modaliases,
File "/home/victor/dev/magicstack/edgedb/edb/schema/ddl.py", line 496, in _delta_from_ddl
schema = cmd.apply(schema, context)
File "/home/victor/dev/magicstack/edgedb/edb/schema/delta.py", line 1531, in apply
schema = self._create_innards(schema, context)
File "/home/victor/dev/magicstack/edgedb/edb/schema/inheriting.py", line 622, in _create_innards
return super()._create_innards(schema, context)
File "/home/victor/dev/magicstack/edgedb/edb/schema/delta.py", line 1498, in _create_innards
schema = op.apply(schema, context=context)
File "/home/victor/dev/magicstack/edgedb/edb/schema/delta.py", line 1527, in apply
schema = self._create_begin(schema, context)
File "/home/victor/dev/magicstack/edgedb/edb/schema/constraints.py", line 641, in _create_begin
constr_base, attrs, inh = Constraint.get_concrete_constraint_attrs(
File "/home/victor/dev/magicstack/edgedb/edb/schema/constraints.py", line 226, in get_concrete_constraint_attrs
args_map = qlutils.index_parameters(
File "/home/victor/dev/magicstack/edgedb/edb/edgeql/utils.py", line 92, in index_parameters
result[p.get_parameter_name(schema)] = e
AttributeError: 'NoneType' object has no attribute 'get_parameter_name'

# Fixed code
def _create_begin(
    self,
    schema: s_schema.Schema,
    context: sd.CommandContext,
) -> s_schema.Schema:
    referrer_ctx = self.get_referrer_context(context)
    if referrer_ctx is None:
        schema = super()._create_begin(schema, context)
        if not context.canonical:
            self._validate_params(schema, context)
        return schema

    subject = referrer_ctx.scls
    assert isinstance(subject, ConsistencySubject)
    if not subject.can_accept_constraints(schema):
        raise errors.UnsupportedFeatureError(
            f"constraints cannot be defined on {subject.get_verbosename(schema)}",
            context=self.source_context,
        )

    if not context.canonical:
        props = self.get_resolved_attributes(schema, context)
        props.pop("name")
        props.pop("subject", None)
        fullname = self.classname
        shortname = sn.shortname_from_fullname(fullname)
        constr_base, attrs, inh = Constraint.get_concrete_constraint_attrs(
            schema, subject, name=shortname, sourcectx=self.source_context, **props
        )

        for k, v in attrs.items():
            inherited = inh.get(k)
            self.set_attribute_value(k, v, inherited=bool(inherited))

        self.set_attribute_value("subject", subject)

    return super()._create_begin(schema, context)