diff --git a/js/core/src/registry.ts b/js/core/src/registry.ts index fdc95f5891..a15ee6e95c 100644 --- a/js/core/src/registry.ts +++ b/js/core/src/registry.ts @@ -200,10 +200,10 @@ export class Registry { const key = `/${type}/${action.__action.name}`; logger.debug(`registering ${key}`); if (this.actionsById.hasOwnProperty(key)) { - // TODO: Make this an error! - logger.warn( - `WARNING: ${key} already has an entry in the registry. Overwriting.` - ); + throw new GenkitError({ + status: 'INVALID_ARGUMENT', + message: `Failed to register ${key} action because it's already in the registry.`, + }); } this.actionsById[key] = action; } @@ -219,10 +219,10 @@ export class Registry { const key = `/${type}/${name}`; logger.debug(`registering ${key} (async)`); if (this.actionsById.hasOwnProperty(key)) { - // TODO: Make this an error! - logger.warn( - `WARNING: ${key} already has an entry in the registry. Overwriting.` - ); + throw new GenkitError({ + status: 'INVALID_ARGUMENT', + message: `Failed to register ${key} action because it's already in the registry.`, + }); } this.actionsById[key] = action; }