{"record":{"id":"12c6476f2defdd31","repo":"moeru-ai/airi","slug":"property-key-version-wasn-t-found-in-the-value-o","errorCode":null,"errorMessage":"property key 'version' wasn't found in the value of key ${key} as ${value}, will keep the current ${toValue(initialValue)}","messagePattern":"property key 'version' wasn't found in the value of key (.+?) as (.+?), will keep the current (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/stage-shared/src/composables/use-versioned-local-storage/index.ts","lineNumber":67,"sourceCode":"              syncDataToStorage.resume()\n            }\n          }\n          else {\n            console.warn(`version ${rawValue.value.version} doesn't satisfy the version ${defaultVersion} for key ${key}, will reset the value to default value ${toValue(initialValue)}`)\n            rawValue.value = { version: defaultVersion, data: toValue(initialValue) }\n            syncDataToStorage.pause()\n            data.value = toValue(initialValue)\n            syncDataToStorage.resume()\n          }\n        }\n\n        syncDataToStorage.pause()\n        data.value = rawValue.value.data!\n        syncDataToStorage.resume()\n        return\n      }\n\n      console.warn(`property key 'version' wasn't found in the value of key ${key} as ${value}, will keep the current ${toValue(initialValue)}`)\n      rawValue.value = { version: defaultVersion, data: toValue(initialValue) }\n      syncDataToStorage.pause()\n      data.value = toValue(initialValue)\n      syncDataToStorage.resume()\n    }\n    catch (err) {\n      console.warn(`failed to un-marshal Local Storage value, possibly due to incompatible or corrupted for key ${key} value ${value}, falling back to default value ${toValue(initialValue)}`, err)\n      rawValue.value = { version: defaultVersion, data: toValue(initialValue) }\n      syncDataToStorage.pause()\n      data.value = toValue(initialValue)\n      syncDataToStorage.resume()\n    }\n  }, {\n    immediate: true,\n    deep: true,\n  })\n\n  return data","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-shared/src/composables/use-versioned-local-storage/index.ts#L49-L85","documentation":"The same composable requires stored values to carry a top-level 'version' property. When the parsed JSON for the key has no version field, it cannot be version-checked, so the value is treated as unrecognizable: storage and data are reset to { version: defaultVersion, data: initialValue } with this warning naming the offending raw value.","triggerScenarios":"A localStorage key written by an older unversioned implementation, another feature using the same key with plain JSON, or hand-edited/devtools-modified storage lacking the envelope.","commonSituations":"Introducing use-versioned-local-storage on a key that previously stored a plain object; key collisions between features; stale values from a pre-release build.","solutions":["Use a new (or newly prefixed) storage key when introducing versioning, so legacy plain values are never read","Pre-migrate on first run: read the raw value yourself, and if it lacks a version, wrap it into the envelope before the composable initializes","Keep localStorage keys unique per feature to avoid cross-writers"],"exampleFix":"// before\nconst { data } = useVersionedLocalStorage('settings', defaults, { version: 1 })\n// legacy key holds { theme: 'dark' } without version -> resets to defaults\n\n// after\nconst legacy = localStorage.getItem('settings')\nif (legacy && !('version' in JSON.parse(legacy))) {\n  localStorage.setItem('settings', JSON.stringify({ version: 1, data: JSON.parse(legacy) }))\n}\nconst { data } = useVersionedLocalStorage('settings', defaults, { version: 1 })","handlingStrategy":"validation","validationCode":"const raw = localStorage.getItem(key)\nif (raw) {\n  const parsed = JSON.parse(raw)\n  if (!('version' in parsed)) {\n    // legacy value: wrap it into the envelope before the composable reads it\n    localStorage.setItem(key, JSON.stringify({ version: 1, data: parsed }))\n  }\n}","typeGuard":"function hasVersionField(value: unknown): value is { version: unknown } {\n  return typeof value === 'object' && value !== null && 'version' in value\n}","tryCatchPattern":null,"preventionTips":["Use a fresh key or prefix when introducing versioned storage","Never share one localStorage key between unrelated features","On first deploy of versioning, run a one-time legacy-to-envelope migration"],"tags":["local-storage","schema-mismatch","versioning","composable"],"backgroundTag":"stored-data-schema-mismatch","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}