caddyserver/caddy · warning

package is not added

Error message

package is not added

What it means

`caddy remove-package` rejects a module that is not part of the current build (lookup in the plugin-package map fails). Note the check uses the SPLIT module name but deletes by the raw arg, so version suffixes are tolerated in the lookup; a miss simply means the binary was never built with that plugin.

Source

Thrown at cmd/packagesfuncs.go:116

		return caddy.ExitCodeFailedStartup, fmt.Errorf("at least one package name must be specified")
	}
	_, nonstandard, _, err := getModules()
	if err != nil {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("unable to enumerate installed plugins: %v", err)
	}
	pluginPkgs, err := getPluginPackages(nonstandard)
	if err != nil {
		return caddy.ExitCodeFailedStartup, err
	}

	for _, arg := range fl.Args() {
		module, _, err := splitModule(arg)
		if err != nil {
			return caddy.ExitCodeFailedStartup, fmt.Errorf("invalid module name: %v", err)
		}
		if _, ok := pluginPkgs[module]; !ok {
			// package does not exist
			return caddy.ExitCodeFailedStartup, fmt.Errorf("package is not added")
		}
		delete(pluginPkgs, arg)
	}

	return upgradeBuild(pluginPkgs, fl)
}

func upgradeBuild(pluginPkgs map[string]pluginPackage, fl Flags) (int, error) {
	l := caddy.Log()

	thisExecPath, err := os.Executable()
	if err != nil {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("determining current executable path: %v", err)
	}
	thisExecStat, err := os.Stat(thisExecPath)
	if err != nil {
		return caddy.ExitCodeFailedStartup, fmt.Errorf("retrieving current executable permission bits: %v", err)
	}

View on GitHub (pinned to 50e54ee279)

Solutions

  1. List what is actually installed: `caddy list-modules --versions --skip-standard` and copy the exact module path
  2. Fix typos/case in the path and retry
  3. If it is a standard module, it cannot be removed — rebuild from source with xcaddy and a trimmed standard set instead

Example fix

# before
caddy remove-package github.com/caddy-dns/cloudflar  # typo

# after
caddy remove-package github.com/caddy-dns/cloudflare
Defensive patterns

Strategy: validation

Validate before calling

MOD=github.com/caddy-dns/cloudflare
caddy list-modules -v --skip-standard 2>/dev/null | grep -q "$MOD" || echo "$MOD not in this build; nothing to remove"

Prevention

When it happens

Trigger: `caddy remove-package github.com/caddy-dns/cloudflare` on a build that doesn't include it; typos in the module path; trying to remove a plugin that ships inside the standard module set.

Common situations: Removing a plugin you added on a different machine/binary; path spelled differently than when added (case, .v2 suffix); assuming a feature is a plugin when it is built-in.

Related errors


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/937f0f393ffad5e5. Report an issue: GitHub.