{"record":{"id":"702b2a49881ef42f","repo":"siyuan-note/siyuan","slug":"parse-imported-notebook-conf-s-failed-w","errorCode":null,"errorMessage":"parse imported notebook conf [%s] failed: %w","messagePattern":"parse imported notebook conf \\[(.+?)\\] failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/import.go","lineNumber":1057,"sourceCode":"\tfor _, entry := range dirs {\n\t\tif !entry.IsDir() || !ast.IsNodeIDPattern(entry.Name()) {\n\t\t\tcontinue\n\t\t}\n\n\t\tboxID := entry.Name()\n\t\tboxDir := filepath.Join(tmpDataPath, boxID)\n\t\tconfPath := filepath.Join(boxDir, \".siyuan\", \"conf.json\")\n\t\tbackupPath := filepath.Join(boxDir, \".siyuan\", notebookCryptoBackupFilename)\n\n\t\tvar boxConf *conf.BoxConf\n\t\tif filelock.IsExist(confPath) {\n\t\t\tdata, readErr := filelock.ReadFile(confPath)\n\t\t\tif readErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"read imported notebook conf [%s] failed: %w\", boxID, readErr)\n\t\t\t}\n\t\t\tboxConf = conf.NewBoxConf()\n\t\t\tif unmarshalErr := gulu.JSON.UnmarshalJSON(data, boxConf); unmarshalErr != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parse imported notebook conf [%s] failed: %w\", boxID, unmarshalErr)\n\t\t\t}\n\t\t}\n\n\t\tvar backup *conf.BoxEncryption\n\t\tif filelock.IsExist(backupPath) {\n\t\t\tbackup, err = readBoxEncryptionFile(backupPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid imported notebook identity [%s]: %w\", boxID, err)\n\t\t\t}\n\t\t}\n\n\t\tvar boxCrypt *conf.BoxEncryption\n\t\tif boxConf != nil && boxConf.Encrypted {\n\t\t\tif boxConf.BoxCrypt != nil && validateBoxEncryption(boxConf.BoxCrypt) == nil {\n\t\t\t\tboxCrypt = boxConf.BoxCrypt\n\t\t\t} else {\n\t\t\t\tboxCrypt = backup\n\t\t\t}","sourceCodeStart":1039,"sourceCodeEnd":1075,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/model/import.go#L1039-L1075","documentation":"Thrown by validateImportedNotebookIdentities when the notebook's conf.json was read successfully but cannot be unmarshaled into conf.BoxConf via gulu.JSON.UnmarshalJSON. The JSON is either syntactically invalid or does not conform to the expected schema. The error wraps the unmarshal error with the boxID.","triggerScenarios":"Calling validateImportedNotebookIdentities where the conf.json content is valid bytes but invalid JSON, or valid JSON with fields that do not match the conf.BoxConf struct. The check is at import.go:1056-1058.","commonSituations":"conf.json truncated due to incomplete export. conf.json from an older or newer SiYuan version with an incompatible schema. Manual editing of conf.json that introduced JSON syntax errors. Encoding issues (BOM, wrong charset) in the file.","solutions":["Open the conf.json from the extracted Data.zip in a JSON validator to find syntax errors.","Re-export the Data.zip from a compatible SiYuan version.","If the schema changed between versions, upgrade or downgrade the source SiYuan to match the target version.","Remove the corrupted notebook directory from the Data.zip and re-export just that notebook."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate conf.json structure before importing\nfunc validateConfJSON(tmpDataPath, boxID string) error {\n    confPath := filepath.Join(tmpDataPath, boxID, \".siyuan\", \"conf.json\")\n    if !filelock.IsExist(confPath) {\n        return nil\n    }\n    data, err := filelock.ReadFile(confPath)\n    if err != nil {\n        return err\n    }\n    var test conf.BoxConf\n    if err := gulu.JSON.UnmarshalJSON(data, &test); err != nil {\n        return fmt.Errorf(\"notebook %s conf.json is invalid JSON: %w\", boxID, err)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"encryptedBoxIDs, err := validateImportedNotebookIdentities(tmpDataPath)\nif err != nil {\n    if strings.Contains(err.Error(), \"parse imported notebook conf\") {\n        // conf.json is corrupt — suggest re-export or manual fix\n        return fmt.Errorf(\"notebook config is corrupted, please re-export the Data archive\")\n    }\n}","preventionTips":["Re-export Data.zip from the source SiYuan to ensure valid JSON.","Ensure source and target SiYuan versions are compatible.","Do not manually edit conf.json files in the archive.","Validate JSON files from the archive before importing if the source is untrusted."],"tags":["encryption","import","data-zip","config","json"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}