{"record":{"id":"dacf780962804a6e","repo":"slopus/happy","slug":"unsupported-claude-goal-action","errorCode":null,"errorMessage":"Unsupported Claude goal action","messagePattern":"Unsupported Claude goal action","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/happy-cli/src/claude/runClaude.ts","lineNumber":578,"sourceCode":"        // which the SDK reads as \"use Claude's own configuration\". Coercing it\n        // would pin every unset session to prompting mode.\n        permissionMode: currentPermissionMode,\n        model: currentModel,\n        fallbackModel: currentFallbackModel,\n        customSystemPrompt: currentCustomSystemPrompt,\n        appendSystemPrompt: currentAppendSystemPrompt,\n        allowedTools: currentAllowedTools,\n        disallowedTools: currentDisallowedTools,\n        effort: currentEffort,\n    });\n\n    session.rpcHandlerManager.registerHandler('goal-action', async (params: unknown) => {\n        const actionParams = params && typeof params === 'object' && !Array.isArray(params)\n            ? params as Record<string, unknown>\n            : null;\n        const command = actionParams ? parseClaudeGoalActionParams(actionParams) : null;\n        if (!command) {\n            throw new Error('Unsupported Claude goal action');\n        }\n        if (pendingClaudeGoalAction) {\n            throw new Error('Claude goal action already in progress');\n        }\n        if (!latestClaudeGoalStatus || latestClaudeGoalStatus.status !== 'active') {\n            throw new Error('No active Claude goal');\n        }\n\n        const capabilities = latestClaudeGoalStatus.capabilities ?? {};\n        if (command.type === 'clear' && !capabilities.clear) {\n            throw new Error('Claude clear goal action is not supported');\n        }\n        if (command.type === 'set' && !capabilities.edit) {\n            throw new Error('Claude edit goal action is not supported');\n        }\n        if (currentRunMode !== 'remote') {\n            throw new Error('Claude goal action is not ready: remote mode is not active');\n        }","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/claude/runClaude.ts#L560-L596","documentation":"The 'goal-action' RPC handler parses incoming params with parseClaudeGoalActionParams; if params are not a plain object or the parse yields no valid command, the handler rejects with this error. It exists to guard the goal-set/clear RPC surface against malformed remote requests from the mobile app.","triggerScenarios":"An RPC 'goal-action' request arrives whose params are null, an array, a primitive, or whose fields fail parseClaudeGoalActionParams validation (e.g. missing/invalid action type or goal text).","commonSituations":"A newer mobile app sending a goal action shape the CLI doesn't understand (version skew); corrupted RPC payloads over the socket; calling the RPC directly with hand-crafted params.","solutions":["Update the CLI and mobile app to matching versions so both speak the same goal-action schema.","Inspect the RPC params in debug logs and fix the payload shape (must be a plain object the parser accepts).","Retry the action from the mobile app.","If you control the sender, validate against the same schema parseClaudeGoalActionParams uses before sending."],"exampleFix":"// before\nsend({ type: 'goal-action', params: 'clear' });\n// after\nsend({ type: 'goal-action', params: { action: 'clear' } });","handlingStrategy":"type-guard","validationCode":"const isPlainObject = (v: unknown): v is Record<string, unknown> =>\n  typeof v === 'object' && v !== null && !Array.isArray(v);\nif (!isPlainObject(params) || !('action' in params)) throw new Error('goal-action params must be an object with an action field');","typeGuard":"function isGoalActionParams(p: unknown): p is { action: 'set' | 'clear'; goal?: string } {\n  if (typeof p !== 'object' || p === null || Array.isArray(p)) return false;\n  const o = p as Record<string, unknown>;\n  return (o.action === 'clear' || (o.action === 'set' && typeof o.goal === 'string'));\n}","tryCatchPattern":"try {\n  await rpc('goal-action', params);\n} catch (err) {\n  if ((err as Error).message === 'Unsupported Claude goal action') {\n    logger.warn('Goal action rejected: payload did not match the expected schema — check CLI/app versions');\n  } else throw err;\n}","preventionTips":["Keep CLI and mobile app versions in sync.","Validate RPC payloads against the shared Zod schema before sending.","Log rejected params to catch schema drift early.","Avoid hand-crafting goal-action RPC payloads."],"tags":["rpc","validation","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}