ramensoftware/windhawk · error

Mod id specified in the source code already exists

Error message

Mod id specified in the source code already exists

What it means

Validation guard in compileEditedMod: after extracting metadata from the mod source, the mod's id differs from the currently edited mod's id (a rename), and a mod with the new id already exists in storage as 'local@<newId>'. Installing would collide with that existing mod, so the compile aborts instead of overwriting an unrelated mod.

Solutions

  1. Change the id in the mod's metadata ([Mod id = ...]) to one not already installed, or revert it to the original edited mod id if the rename was accidental
  2. Uninstall or rename the existing local@<newId> mod in Windhawk first, then recompile
  3. Keep the original id if the intent was to update the same mod rather than create a distinct one
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/windhawk-vscode/src/extension.ts:1763 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ramensoftware/windhawk@61d99ed8e1 (2026-09-12). Data as JSON: /api/errors/a9c8ef875a2cf335. Report an issue: GitHub.

Appendix: source

Thrown at src/windhawk-vscode/src/extension.ts:1763

					throw new Error('No mod is being edited');
				}

				const oldModId = this._editedModId;
				const localOldModId = 'local@' + this._editedModId;

				const modSource = readModSource(this._utils.editorWorkspace);

				const metadata = await extractMetadataOrThrow(this._utils.core, modSource, this._language);
				if (!metadata.id) {
					throw new Error('Mod id must be specified in the source code');
				}

				const modId = metadata.id;
				const localModId = 'local@' + modId;

				if (modId !== oldModId) {
					if (await this._utils.core.doesModExist(localModId)) {
						throw new Error('Mod id specified in the source code already exists');
					}
				}

				const compileOp = this._utils.core.installMod({
					storageId: localModId,
					source: modSource,
					metadata,
					disabled: data.disabled,
					loggingEnabled: data.loggingEnabled,
					compileLocally: true,
					trackInProfile: false,
					pchFolder: this._utils.editorWorkspace.getWorkspaceFolder(),
					renameFromStorageId: modId !== oldModId ? localOldModId : undefined,
				});
				this._currentCompileOp = compileOp;
				const result = await compileOp.result;

				if (modId !== oldModId) {

View on GitHub (pinned to 61d99ed8e1)