eyaltoledano/claude-task-master · warning

Invalid value for ${mapping.env}: ${value}

Error message

Invalid value for ${mapping.env}: ${value}

What it means

environment-config-provider.service.ts maps environment variables to config paths. When a mapped env var has a value but the mapping's optional `validate` predicate rejects it, the provider logs this warning and skips setting the property, leaving the config value at its default.

Source

Thrown at packages/tm-core/src/modules/config/services/environment-config-provider.service.ts:81

		];
	}

	/**
	 * Load configuration from environment variables
	 */
	loadConfig(): PartialConfiguration {
		const config: PartialConfiguration = {};

		for (const mapping of this.mappings) {
			// Skip runtime state variables
			if (mapping.isRuntimeState) continue;

			const value = process.env[mapping.env];
			if (!value) continue;

			// Validate value if validator is provided
			if (mapping.validate && !mapping.validate(value)) {
				this.logger.warn(`Invalid value for ${mapping.env}: ${value}`);
				continue;
			}

			// Set the value in the config object
			this.setNestedProperty(config, mapping.path, value);
		}

		return config;
	}

	/**
	 * Get runtime state from environment variables
	 */
	getRuntimeState(): Record<string, string> {
		const state: Record<string, string> = {};

		for (const mapping of this.mappings) {
			if (!mapping.isRuntimeState) continue;

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Read the warning to identify the offending env var and fix its value so it passes the mapping's validate function
  2. Check the mapping definition to see which env var names have validators and what format they expect
  3. Remove or unset the env var if you want the built-in default to apply instead
  4. Add or relax the validator in the config mapping if the rejected value is actually legitimate

Example fix

// before
TIMEOUT_MS=soon
// after
TIMEOUT_MS=30000
Defensive patterns

Strategy: validation

Validate before calling

const raw = process.env.TIMEOUT_MS;
const isValid = raw !== undefined && Number.isFinite(Number(raw));
if (!isValid) console.warn('TIMEOUT_MS must be a number; got', raw);

Prevention

When it happens

Trigger: Calling loadConfig() while an env var like a timeout or URL has a value that fails the mapping's validator (e.g. non-numeric string for a numeric field, malformed URL).

Common situations: Typo in a numeric env var ('tahirty' instead of '30'), port set to a non-number, empty-but-truthy strings, values copied with units ('500ms' where a plain number is expected), stale .env files after a schema change.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/0aa7ff262a199784. Report an issue: GitHub.