logseq / logseq/logseq

Fails to load block - block/collapsed should be marked as db/index true

Open
#4,093 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

:status/automatic-stale :type/bug props
Dominant language
Clojure
Stars
45k
Forks
2.8k
Avg merge
1d 22h
Merged PRs (30d)
105

Description

### What happened?

Certain pages fail to be loaded, I only see a blank page and have to restart Logseq after (no UI visible). Even after a restart the page cannot be loaded. I created the page a while ago and only when accessing it it fails.

Unfortunately, I cannot share the contents of the page but will see if I can work on a minified example.

The error message is:

```
core.cljs:4004 [frontend.handler] {:exception #error {:message "Attribute :block/collapsed? should be marked as :db/index true", :data {:error :index-access, :index :avet, :components [:block/collapsed?]}}, :line 42}
$cljs$core$apply_to_simple$cljs$0core$0IFn$0_invoke$0arity$06$$ @ core.cljs:4004
console.cljs:29 [frontend.handler] #error {:message "Attribute :block/collapsed? should be marked as :db/index true", :data {:error :index-access, :index :avet, :components [:block/collapsed?]}}
Error: Attribute :block/collapsed? should be marked as :db/index true
at new $APP.$cljs$core$ExceptionInfo$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:11099:25)
at Function.$APP.$cljs$core$ex_info$$.$cljs$core$IFn$_invoke$arity$3$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:73974:10)
at Function.$APP.$cljs$core$ex_info$$.$cljs$core$IFn$_invoke$arity$2$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:73971:36)
at $datascript$db$DB$$.$APP.$JSCompiler_prototypeAlias$$.$datascript$db$IIndexAccess$_datoms$arity$3$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:85515:37)
at $datascript$db$_datoms$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:19984:91)
at $datascript$core$datoms$cljs$0core$0IFn$0_invoke$0arity$03$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:23823:10)
at $frontend$db$model$get_limited_blocks$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:27512:33)
at file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:27556:215
at Function.$frontend$db$react$q$$.$cljs$core$IFn$_invoke$arity$variadic$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:91225:279)
at $frontend$db$react$q$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:91210:33)
(anonymous) @ console.cljs:29
react-dom.production.min.js:124 Uncaught $APP.$cljs$core$ExceptionInfo$$$cause$: nullcolumnNumber: undefineddata: $APP.$cljs$core$PersistentArrayMap$$ {meta: null, $cnt$: 3, $arr$: Array(6), $__hash$: null, $cljs$lang$protocol_mask$partition0$$: 16647951, …}description: undefinedfileName: undefinedlineNumber: undefinedmessage: "Attribute :block/collapsed? should be marked as :db/index true"name: "Error"number: undefinedstack: "Error: Attribute :block/collapsed? should be marked as :db/index true\n at new $APP.$cljs$core$ExceptionInfo$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:11099:25)\n at Function.$APP.$cljs$core$ex_info$$.$cljs$core$IFn$_invoke$arity$3$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:73974:10)\n at Function.$APP.$cljs$core$ex_info$$.$cljs$core$IFn$_invoke$arity$2$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:73971:36)\n at $datascript$db$DB$$.$APP.$JSCompiler_prototypeAlias$$.$datascript$db$IIndexAccess$_datoms$arity$3$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:85515:37)\n at $datascript$db$_datoms$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:19984:91)\n at $datascript$core$datoms$cljs$0core$0IFn$0_invoke$0arity$03$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:23823:10)\n at $frontend$db$model$get_limited_blocks$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:27512:33)\n at file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:27556:215\n at Function.$frontend$db$react$q$$.$cljs$core$IFn$_invoke$arity$variadic$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:91225:279)\n at $frontend$db$react$q$$ (file:///Applications/Logseq.app/Contents/Resources/app/js/main.js:91210:33)"[[Prototype]]: Error
```

### Reproduce the Bug

1. Start Logseq
2. Open specific page

### Expected Behavior

_No response_

### Screenshots

![image](https://user-images.githubusercontent.com/45070265/151755054-9ded4fb2-f50c-4951-a7b1-986c97fdd785.png)

### Desktop Platform Information

- Device: MacOS
- OS: 11.6.3
- Version: 0.5.9

### Mobile Platform Information

_No response_

### Additional Context

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from frontend.db.model/get-limited-blocks in the stack trace and trace how :block/collapsed? is accessed, then inspect the database schema/index definition for that attribute. Reproduce by opening the affected page if a usable example becomes available; done means the page loads without the reported index-access error.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.