slint-ui/slint · warning

Duplicated callback name

Error message

Duplicated callback name ${callbackName}

What it means

When wrapping a compiled Slint component into a JS Component object, each declared callback is exposed as an invocable property. If the translated callback name already exists on the object (colliding with another callback, property, function, or a built-in member), the callback is skipped and this warning is printed. The callback will be undefined under that name and invoking it will fail at runtime.

Solutions

  1. Rename one of the colliding callbacks in the .slint file to a unique name
  2. Identify the colliding name from the warning and search the .slint source for both kebab-case and camelCase spellings
  3. Invoke the callback via instance.invoke(originalName, ...) if renaming is not possible

Example fix

// before (file.slint)
callback do-action(int);
callback doAction(string);
// after (file.slint)
callback do-action(int);
callback send-text(string);
Defensive patterns

Strategy: validation

Validate before calling

const names = definition.callbacks.map(translateName);
const dupes = names.filter((n, i) => names.indexOf(n) !== i);
if (dupes.length) throw new Error(`Duplicate callback names: ${dupes}`);

Type guard

function callbackExists(component, name) {
  return typeof component[name] === 'function';
}

Prevention

When it happens

Trigger: Calling loadFile() or loadSource() on a component with two callbacks translating to the same JS name (e.g. 'do-action' and 'doAction'), or a callback named like an existing member of Component such as 'run'.

Common situations: Mixed-casing duplicates in hand-edited .slint files; code generators emitting names that differ only in case; callbacks named after Object.prototype members or existing API surface.

Related errors


AI-assisted analysis of slint-ui/slint@bb937076de (2026-09-16). Data as JSON: /api/errors/20861b6662c608c6. Report an issue: GitHub.

Appendix: source

Thrown at api/node/typescript/index.ts:450

                        console.warn("Duplicated property name " + propName);
                    } else {
                        Object.defineProperty(componentHandle, propName, {
                            get() {
                                return instance!.getProperty(prop.name);
                            },
                            set(value) {
                                instance!.setProperty(prop.name, value);
                            },
                            enumerable: true,
                        });
                    }
                });

                instance!.definition().callbacks.forEach((cb) => {
                    const callbackName = translateName(cb);

                    if (componentHandle[callbackName] !== undefined) {
                        console.warn(
                            "Duplicated callback name " + callbackName,
                        );
                    } else {
                        Object.defineProperty(
                            componentHandle,
                            translateName(cb),
                            {
                                get() {
                                    return function () {
                                        return instance!.invoke(
                                            cb,
                                            Array.from(arguments),
                                        );
                                    };
                                },
                                set(callback) {
                                    instance!.setCallback(cb, callback);
                                },

View on GitHub (pinned to bb937076de)