{"record":{"id":"9975c25185ce3645","repo":"tailscale/tailscale","slug":"newfilestore-q-w","errorCode":null,"errorMessage":"NewFileStore(%q): %w","messagePattern":"NewFileStore\\(%q\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ipn/store/stores.go","lineNumber":302,"sourceCode":"\tif isTPM == toTPM {\n\t\t// No migration needed.\n\t\treturn nil\n\t}\n\n\tnewTPMStore, ok := knownStores[TPMPrefix]\n\tif !ok {\n\t\treturn errors.New(\"this build does not support TPM integration\")\n\t}\n\n\t// Open from (old format) and to (new format) stores for migration. The\n\t// \"to\" store will be at tmpPath.\n\tvar from, to ipn.StateStore\n\ttmpPath := path + \".tmp\"\n\tif toTPM {\n\t\t// Migrate plaintext file to be TPM-sealed.\n\t\tfrom, err = NewFileStore(logf, path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"NewFileStore(%q): %w\", path, err)\n\t\t}\n\t\tto, err = newTPMStore(logf, TPMPrefix+tmpPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"newTPMStore(%q): %w\", tmpPath, err)\n\t\t}\n\t} else {\n\t\t// Migrate TPM-selaed file to plaintext.\n\t\tfrom, err = newTPMStore(logf, TPMPrefix+path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"newTPMStore(%q): %w\", path, err)\n\t\t}\n\t\tto, err = NewFileStore(logf, tmpPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"NewFileStore(%q): %w\", tmpPath, err)\n\t\t}\n\t}\n\tdefer os.Remove(tmpPath)\n","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/tailscale/tailscale/blob/6e0912f97994f927632b34ae9e63b53d6516a6ac/ipn/store/stores.go#L284-L320","documentation":"Raised in maybeMigrateLocalStateFile when migrating a plaintext state file to TPM-sealed form, and the existing plaintext file at path cannot be opened as a FileStore. The source of the migration is unreadable or malformed, so the migration is aborted before any TPM store is created.","triggerScenarios":"Thrown at ipn/store/stores.go:302 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Creating the file-backed state store failed; check the state file path is writable and the directory exists."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e0912f97994f927632b34ae9e63b53d6516a6ac","analyzedAt":"2026-08-18T08:17:25.280Z","contentChangedAt":"2026-08-18T08:17:25.280Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}