{"record":{"id":"b91b2b2e6eac9cc4","repo":"siyuan-note/siyuan","slug":"database-not-found-s","errorCode":null,"errorMessage":"database not found: %s","messagePattern":"database not found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/cli/cmd/database.go","lineNumber":65,"sourceCode":"\t\t\treturn printJSON(results)\n\t\tdefault:\n\t\t\tprintAvSearchResults(results)\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar databaseGetCmd = &cobra.Command{\n\tUse:   \"get --av <avID>\",\n\tShort: \"Get database content\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tavID, _ := cmd.Flags().GetString(\"av\")\n\t\tif avID == \"\" {\n\t\t\treturn fmt.Errorf(\"--av is required\")\n\t\t}\n\t\tattrView := model.GetAttributeView(avID)\n\t\tif attrView == nil {\n\t\t\treturn fmt.Errorf(\"database not found: %s\", avID)\n\t\t}\n\t\tswitch outputFormat {\n\t\tcase \"json\":\n\t\t\treturn printJSON(model.NewAttributeViewMetadata(attrView))\n\t\tdefault:\n\t\t\tprintDatabaseMetadata(attrView)\n\t\t}\n\t\treturn nil\n\t},\n}\n\nvar databaseRenderCmd = &cobra.Command{\n\tUse:   \"render --av <avID>\",\n\tShort: \"Render database data\",\n\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\tavID, _ := cmd.Flags().GetString(\"av\")\n\t\tviewID, _ := cmd.Flags().GetString(\"view\")\n\t\tquery, _ := cmd.Flags().GetString(\"query\")","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/cli/cmd/database.go#L47-L83","documentation":"`database get` found the `--av` flag non-empty, but model.GetAttributeView returned nil — no attribute view with that ID exists (or it failed to load). The command turns the nil lookup result into this error naming the requested ID.","triggerScenarios":"Running `siyuan database get --av <id>` where the ID does not correspond to any existing attribute view in the workspace.","commonSituations":"Using a block ID instead of the database (av) ID; the database was deleted or renamed since the script was written; working against a different workspace than where the database lives; truncated or mistyped IDs.","solutions":["Verify the av ID — open the database block and copy its ID (the `custom-av`/av ID, not the block ID)","Run in the correct workspace (`--workspace`) where the database exists","List databases via the SQL/API to confirm the ID exists","Re-check the ID for truncation or typos"],"exampleFix":"// before\nsiyuan database get --av 20240101120000-blockid\n// after\nsiyuan database get --av 20240101120000-avxyz","handlingStrategy":"validation","validationCode":"test -n \"$AV_ID\" && siyuan database get --av \"$AV_ID\" || echo \"av id missing or database absent\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Distinguish av IDs from block/view IDs","Re-copy IDs after database restructuring","Pin the workspace with `--workspace` in scripts","Check the database still exists before operating on it"],"tags":["cli","database","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}