{"record":{"id":"b503dd2a042a2222","repo":"eyaltoledano/claude-task-master","slug":"invalid-response-language","errorCode":"INVALID_RESPONSE_LANGUAGE","errorMessage":"Invalid response language: ${lang}. Must be a non-empty string.","messagePattern":"Invalid response language: (.+?)\\. Must be a non-empty string\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/modules/task-manager/response-language.js","lineNumber":47,"sourceCode":"\t);\n\n\tif (!configExists) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'CONFIG_MISSING',\n\t\t\t\tmessage:\n\t\t\t\t\t'The configuration file is missing. Run \"task-master init\" to create it.'\n\t\t\t}\n\t\t};\n\t}\n\n\t// Validate response language\n\tif (typeof lang !== 'string' || lang.trim() === '') {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror: {\n\t\t\t\tcode: 'INVALID_RESPONSE_LANGUAGE',\n\t\t\t\tmessage: `Invalid response language: ${lang}. Must be a non-empty string.`\n\t\t\t}\n\t\t};\n\t}\n\n\ttry {\n\t\tconst currentConfig = getConfig(projectRoot);\n\t\tcurrentConfig.global.responseLanguage = lang;\n\t\tconst writeResult = writeConfig(currentConfig, projectRoot);\n\n\t\tif (!writeResult) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\terror: {\n\t\t\t\t\tcode: 'WRITE_ERROR',\n\t\t\t\t\tmessage: 'Error writing updated configuration to configuration file'\n\t\t\t\t}\n\t\t\t};","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/scripts/modules/task-manager/response-language.js#L29-L65","documentation":"setResponseLanguage() validates that the requested language is a non-empty, non-whitespace string. Passing anything else (undefined, null, '', '   ', a non-string) returns this structured validation failure before any config is touched.","triggerScenarios":"setResponseLanguage(undefined, root) — e.g. `task-master response-language --set` with no value; --set given an empty string via shell quoting (''); a script passing a variable that is unset or a non-string type.","commonSituations":"CLI flag missing its value so the parsed option is undefined; shell variable interpolation producing an empty string ($LANG unset); YAML/JSON automation scripts sending null; misunderstanding the accepted values (expects language names/strings like 'spanish', 'english').","solutions":["Re-run with an explicit language value, e.g. `task-master response-language --set spanish`.","In scripts, guard first: if (typeof lang === 'string' && lang.trim()) await setResponseLanguage(lang, root).","Quote shell values properly (LANG_VALUE=\"spanish\"; --set \"$LANG_VALUE\") so empty interpolation doesn't produce an empty string.","Check `task-master response-language` (no --set) to see the current setting and accepted value format."],"exampleFix":"// before\nawait setResponseLanguage(opts.language, projectRoot); // opts.language undefined when flag value omitted\n// after\nconst lang = String(opts.language ?? '').trim();\nif (!lang) throw new Error('--set requires a language value, e.g. --set spanish');\nawait setResponseLanguage(lang, projectRoot);","handlingStrategy":"validation","validationCode":"function canSetResponseLanguage(lang) {\n  return typeof lang === 'string' && lang.trim() !== '';\n}\nif (!canSetResponseLanguage(lang)) {\n  throw new Error('Pass a language value, e.g. --set spanish');\n}\nawait setResponseLanguage(lang, projectRoot);","typeGuard":"function isNonEmptyString(v) {\n  return typeof v === 'string' && v.trim().length > 0;\n}\nif (isNonEmptyString(lang)) {\n  await setResponseLanguage(lang, projectRoot);\n}","tryCatchPattern":"const res = await setResponseLanguage(lang, projectRoot);\nif (!res.success && res.error?.code === 'INVALID_RESPONSE_LANGUAGE') {\n  console.error('Usage: task-master response-language --set <language>');\n  process.exitCode = 1;\n}","preventionTips":["Require the --set flag value at the CLI-parsing layer (Commander .argument('<lang>')) so it can't be undefined.","Quote interpolated shell values: --set \"$LANG_VALUE\" and default empty vars with ${LANG_VALUE:-spanish}.","Normalize input with .trim() and a lowercase/known-language whitelist before calling.","Document accepted language values in your automation configs to avoid null/empty submissions."],"tags":["validation","argument-error","configuration"],"backgroundTag":"invalid-language-value","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}