{"record":{"id":"55afe8a362093cee","repo":"Yeachan-Heo/oh-my-codex","slug":"target-value-must-be-a-non-empty-string","errorCode":null,"errorMessage":"`target.value` must be a non-empty string","messagePattern":"`target\\.value` must be a non-empty string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/tmux-hook.ts","lineNumber":126,"sourceCode":"\nfunction parseConfig(raw: unknown): TmuxHookConfig {\n  if (!raw || typeof raw !== 'object') {\n    throw new Error('tmux-hook config must be a JSON object');\n  }\n  const parsed = raw as Record<string, unknown>;\n  if (parsed.enabled !== true && parsed.enabled !== false) {\n    throw new Error('`enabled` must be boolean');\n  }\n  const target = parsed.target;\n  if (!target || typeof target !== 'object') {\n    throw new Error('`target` is required');\n  }\n  const targetObj = target as Record<string, unknown>;\n  if (targetObj.type !== 'session' && targetObj.type !== 'pane') {\n    throw new Error('`target.type` must be \"session\" or \"pane\"');\n  }\n  if (typeof targetObj.value !== 'string' || targetObj.value.trim() === '') {\n    throw new Error('`target.value` must be a non-empty string');\n  }\n\n  const allowedModes = parsed.allowed_modes;\n  if (!Array.isArray(allowedModes) || allowedModes.length === 0 || allowedModes.some(v => typeof v !== 'string')) {\n    throw new Error('`allowed_modes` must be a non-empty string array');\n  }\n\n  const cooldown = parsed.cooldown_ms;\n  const maxInjections = parsed.max_injections_per_session;\n  if (typeof cooldown !== 'number' || cooldown < 0 || !Number.isFinite(cooldown)) {\n    throw new Error('`cooldown_ms` must be a non-negative number');\n  }\n  if (typeof maxInjections !== 'number' || maxInjections < 1 || !Number.isFinite(maxInjections)) {\n    throw new Error('`max_injections_per_session` must be >= 1');\n  }\n\n  const promptTemplate = parsed.prompt_template;\n  const marker = parsed.marker;","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/tmux-hook.ts#L108-L144","documentation":"The config's target.value (the session name or pane id to target) must be a non-empty string. Whitespace-only strings also fail because of the .trim() check.","triggerScenarios":"\"value\": \"\", \"value\": \"   \", value set to a number (e.g. pane id 3 without quotes), or the key missing so it is undefined.","commonSituations":"Numeric tmux pane ids written as JSON numbers instead of strings; empty template placeholders never filled in.","solutions":["Set value to a real session name or pane id string, e.g. \"%5\" or \"main-session\"","Quote numeric ids: \"3\" not 3","Run tmux list-sessions / list-panes to get the exact identifier"],"exampleFix":"// before\n{\"target\": {\"type\": \"pane\", \"value\": 3}}\n// after\n{\"target\": {\"type\": \"pane\", \"value\": \"%3\"}}","handlingStrategy":"validation","validationCode":"const v = cfg.target?.value;\nif (typeof v !== 'string' || v.trim() === '') throw new Error('bad target.value');","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim() !== '';","tryCatchPattern":"try { await loadConfig(); } catch (e) { if (e instanceof Error && e.message.includes('target.value')) fixValue(); }","preventionTips":["Quote pane ids in JSON: \"%3\" not 3","Get exact ids from tmux list-panes / list-sessions"],"tags":["config","validation","string","tmux-hook"],"backgroundTag":"config-schema-validation-failed","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}