zk icon indicating copy to clipboard operation
zk copied to clipboard

sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported

Open WhyNotHugo opened this issue 5 months ago • 13 comments

Check if applicable

  • [x] I have searched the existing issues (required)
  • [x] I'm willing to help fix the problem and contribute a pull request

Describe the bug

The following output is produced when running zk:

zk: warning: sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported
zk: warning: sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported
zk: warning: sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported
zk: warning: sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported
zk: warning: sql: Scan error on column index 2, name "source_path": converting NULL to string is unsupported

How to reproduce?

This happens when I create new notes on another host and sync them over. I need to narrow down the exact sequence, but generally, I:

  • Sync notes between two hosts using syncthing.
  • Edit and create notes on host B.
  • Let notes sync.
  • Run zk on host B

zk configuration

[notebook]
dir = "~/zk"

[note]
filename = "{{id}}"

[format.markdown]
hashtags = true
link-format = "[{{title}}]({{rel-path}})"

[lsp.diagnostics]
dead-link = "error"

[alias]
n = "zk new"
nj = "zk new ~/zk/journal/"
e = "zk edit --interactive --exclude journal"
ea = "zk edit --interactive"
ej = "zk edit --interactive journal --sort path-"

[group.journal]
paths = ["journal"]

[group.journal.note]
filename = "{{format-date now '%Y-%m-%d_%H%M'}}"
template = "journal.md"

[tool]
# pandoc wraps even if told not to; --columns works around this
fzf-preview = "pandoc {-1} --wrap none --columns=8000 -t ansi"

Environment

zk 
system: Linux 6.15.0-0-edge x86_64 Linux

WhyNotHugo avatar Jul 03 '25 22:07 WhyNotHugo

zk is 0.15.1-r1 from Alpine packages

WhyNotHugo avatar Jul 03 '25 22:07 WhyNotHugo

What happens if you delete notebook.db and index again? I get this error when the frontmatter is somehow broken, because of an unquoted title with : in it for example

tjex avatar Jul 04 '25 15:07 tjex

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

github-actions[bot] avatar Aug 04 '25 01:08 github-actions[bot]

Kkooppp

On Mon, 4 Aug 2025, at 03:46, github-actions[bot] wrote:

github-actions[bot] left a comment (zk-org/zk#554) https://github.com/zk-org/zk/issues/554#issuecomment-3148892227 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

— Reply to this email directly, view it on GitHub https://github.com/zk-org/zk/issues/554#issuecomment-3148892227, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSNO5OQGSIW55OJOSLEZ33L23NVAVCNFSM6AAAAACAX5OIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTCNBYHA4TEMRSG4. You are receiving this because you authored the thread.Message ID: @.***>

-- Hugo

WhyNotHugo avatar Aug 04 '25 08:08 WhyNotHugo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

github-actions[bot] avatar Sep 04 '25 23:09 github-actions[bot]

asfasdfsdf

On Fri, 5 Sep 2025, at 01:03, github-actions[bot] wrote:

github-actions[bot] left a comment (zk-org/zk#554) https://github.com/zk-org/zk/issues/554#issuecomment-3256176225 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs in the next 5 days.

— Reply to this email directly, view it on GitHub https://github.com/zk-org/zk/issues/554#issuecomment-3256176225, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFSNO5FBPX6MYAKYAQSJJD3RDANNAVCNFSM6AAAAACAX5OIISVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTENJWGE3TMMRSGU. You are receiving this because you authored the thread.Message ID: @.***>

-- Hugo

WhyNotHugo avatar Sep 05 '25 00:09 WhyNotHugo

What happens if you delete notebook.db and index again? I get this error when the frontmatter is somehow broken, because of an unquoted title with : in it for example

@WhyNotHugo

And so this error only crops up on the destination machine, in terms of a synced notebook?

tjex avatar Sep 05 '25 08:09 tjex

So I been getting this issue as well. deleting the sqlite db and creating again doesn't really do much it as the issue show up again

gozes avatar Oct 30 '25 10:10 gozes

This error has only ever occured to me when I have broken frontmatter. eg commonly,

---
title: A title like this: will break
---

when what we want is

---
title: "A title like this: will break"
---

tjex avatar Oct 30 '25 15:10 tjex

I use a template that already has the title wrapped as a string so that shouldn't happened. That said both of does a valid YAML so in theory it should accept both no? Ether with " or without is valid so not sure why it won't accept it

gozes avatar Oct 30 '25 19:10 gozes

This error could well be thrown on any other yaml field though. Not just the title. Not sure how to progress with this one. I guess it would be a good first step to try and print the file paths that are being read as zk index goes through them. The problem file in question should then be the last before the error.

tjex avatar Nov 08 '25 18:11 tjex

This error could well be thrown on any other yaml field though. Not just the title. Not sure how to progress with this one. I guess it would be a good first step to try and print the file paths that are being read as zk index goes through them. The problem file in question should then be the last before the error.

That would definitely be helpful. If possible it would be good, depending on the context available when the error is thrown, to maybe suggest what maybe wrong so I can try and fix the file then running zk index again to confirm that the file is now fix

gozes avatar Nov 08 '25 23:11 gozes

looks like it's already supported: zk index --verbose

tjex avatar Nov 15 '25 18:11 tjex