{"record":{"id":"ded055bd2037193c","repo":"slopus/happy","slug":"invalid-sandbox-config-skipping-error-err","errorCode":null,"errorMessage":"⚠️ Invalid sandbox config - skipping. Error: ${error.message}","messagePattern":"⚠️ Invalid sandbox config - skipping\\. Error: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/happy-cli/src/persistence.ts","lineNumber":110,"sourceCode":"    // Check schema version (default to 1 if missing)\n    const schemaVersion = raw.schemaVersion ?? 1;\n\n    // Warn if schema version is newer than supported\n    if (schemaVersion > SUPPORTED_SCHEMA_VERSION) {\n      logger.warn(\n        `⚠️ Settings schema v${schemaVersion} > supported v${SUPPORTED_SCHEMA_VERSION}. ` +\n        'Update happy-cli for full functionality.'\n      );\n    }\n\n    // Migrate if needed\n    const migrated = migrateSettings(raw, schemaVersion);\n\n    if (migrated.sandboxConfig !== undefined) {\n      try {\n        migrated.sandboxConfig = SandboxConfigSchema.parse(migrated.sandboxConfig);\n      } catch (error: any) {\n        logger.warn(`⚠️ Invalid sandbox config - skipping. Error: ${error.message}`);\n        migrated.sandboxConfig = undefined;\n      }\n    }\n\n    // Merge with defaults to ensure all required fields exist\n    return { ...defaultSettings, ...migrated };\n  } catch (error: any) {\n    logger.warn(`Failed to read settings: ${error.message}`);\n    // Return defaults on any error\n    return { ...defaultSettings }\n  }\n}\n\nexport async function writeSettings(settings: Settings): Promise<void> {\n  if (!existsSync(configuration.happyHomeDir)) {\n    await mkdir(configuration.happyHomeDir, { recursive: true })\n  }\n","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/slopus/happy/blob/b824cd0a4681d41af631a8e422a813873e4455b0/packages/happy-cli/src/persistence.ts#L92-L128","documentation":"readSettings in happy-cli validates the persisted sandboxConfig against SandboxConfigSchema (zod). If the stored sandbox config fails schema validation, it logs this warning and drops sandboxConfig (sets it to undefined), so defaults are used instead of crashing. It is a non-fatal degradation of sandbox settings.","triggerScenarios":"Settings file (~/.happy/settings.json or equivalent) contains a sandboxConfig object that fails SandboxConfigSchema.parse — e.g. wrong types, missing required fields, or an unknown/renamed field after a schema version bump, even after migrateSettings ran.","commonSituations":"Hand-edited settings.json with a typo (enabled: \"true\" instead of boolean), an old settings file written by a previous happy version whose sandbox schema has since changed, or config synced from another machine with a different happy version.","solutions":["Open your happy settings file and fix sandboxConfig to match SandboxConfigSchema (correct types and required fields).","Simplest fix: delete the sandboxConfig key (or the whole file) and let happy regenerate defaults, then re-enable sandbox via happy's settings UI/command.","Check the zod error message in the warning — it names the exact failing field/path.","Upgrade or align happy CLI version if the file was written by a different version with a different sandbox schema."],"exampleFix":"// before (~/.happy/settings.json)\n{ \"sandboxConfig\": { \"enabled\": \"yes\", \"profile\": {} } }\n// after\n{ \"sandboxConfig\": { \"enabled\": true } }","handlingStrategy":"validation","validationCode":"import { SandboxConfigSchema } from '@/sandbox/schema'; // adjust to actual export\nconst raw = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));\nif (raw.sandboxConfig !== undefined) {\n  const result = SandboxConfigSchema.safeParse(raw.sandboxConfig);\n  if (!result.success) {\n    console.warn('sandboxConfig invalid:', result.error.issues.map(i => `${i.path.join('.')}: ${i.message}`));\n    delete raw.sandboxConfig; // let happy use defaults\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't hand-edit settings.json; use happy's settings command/UI.","Keep happy CLI versions in sync across machines that share settings.","After a happy upgrade, diff your settings against the documented sandbox schema.","Keep a backup before editing settings files."],"tags":["settings","zod-validation","sandbox","config"],"backgroundTag":"schema-validation-failed","analyzedSha":"b824cd0a4681d41af631a8e422a813873e4455b0","analyzedAt":"2026-08-31T23:12:36.205Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}