matrix-org / matrix-org/matrix-rust-sdk
Error: invalid type: newtype struct, expected any valid JSON value at line 1 column 1061
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.3k
- Forks
- 500
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 106
Description
I wrote a Matrix bot using this library a while ago. Today, it won't start.
On startup, it just prints:
> `Error: invalid type: newtype struct, expected any valid JSON value at line 1 column 1061`
and exits.
I'm guessing some file got corrupted. But how can I find which?
My usual debugging methods failed me.
- Searching for the error message on the Internet did not provide any insight.
- `RUST_BACKTRACE=1` has no effect.
- `RUST_BACKTRACE=full` has no effect.
- Running under gdb has no effect.
- Installing a panic hook with `std::panic::set_hook` has no effect.
- Breakpointing `write` did allow me to get a backtrace of what is printing that error message, but it's useless:
```
Thread 1 "matrix_bot" hit Breakpoint 1, 0x00007ffff751a170 in write () from /usr/lib/libc.so.6
(gdb) where
#0 0x00007ffff751a170 in write () from /usr/lib/libc.so.6
#1 0x0000555557d29ebd in std::sys::pal::unix::fd::FileDesc::write () at library/std/src/sys/pal/unix/fd.rs:264
#2 std::sys::pal::unix::stdio::{impl#5}::write () at library/std/src/sys/pal/unix/stdio.rs:71
#3 std::io::Write::write_all () at library/std/src/io/mod.rs:1706
#4 std::io::stdio::{impl#2}::write_all () at library/std/src/io/stdio.rs:176
#5 0x0000555557d2bd59 in std::io::stdio::{impl#21}::write_all () at library/std/src/io/stdio.rs:976
#6 std::io::Write::write_fmt::{impl#0}::write_str () at library/std/src/io/mod.rs:1835
#7 0x0000555557d5873c in core::fmt::write () at library/core/src/fmt/mod.rs:1118
#8 0x0000555557d2a67b in std::io::Write::write_fmt () at library/std/src/io/mod.rs:1846
#9 std::io::stdio::{impl#20}::write_fmt () at library/std/src/io/stdio.rs:956
#10 0x0000555557d2aab2 in std::io::stdio::{impl#19}::write_fmt () at library/std/src/io/stdio.rs:930
#11 std::io::stdio::attempt_print_to_stderr () at library/std/src/io/stdio.rs:1057
#12 0x00005555559d9491 in std::process::{impl#61}::report<(), anyhow::Error> (self=...)
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/process.rs:2443
#13 0x0000555555b720b9 in std::rt::lang_start::{closure#0}> ()
at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:166
#14 0x0000555557d24ef1 in core::ops::function::impls::{impl#2}::call_once<(), (dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> () at library/core/src/ops/function.rs:284
#15 std::panicking::try::do_call<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panicking.rs:554
#16 std::panicking::try + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe)> ()
at library/std/src/panicking.rs:518
#17 std::panic::catch_unwind<&(dyn core::ops::function::Fn<(), Output=i32> + core::marker::Sync + core::panic::unwind_safe::RefUnwindSafe), i32> () at library/std/src/panic.rs:142
#18 std::rt::lang_start_internal::{closure#2} () at library/std/src/rt.rs:148
#19 std::panicking::try::do_call () at library/std/src/panicking.rs:554
#20 std::panicking::try () at library/std/src/panicking.rs:518
#21 std::panic::catch_unwind () at library/std/src/panic.rs:142
#22 std::rt::lang_start_internal () at library/std/src/rt.rs:148
#23 0x0000555555b7208a in std::rt::lang_start> (main=0x55555592ea90 , argc=1,
argv=0x7fffffffdca8, sigpipe=0) at /rustc/25ef9e3d85d934b27d9dada2f9dd52b1dc63bb04/library/std/src/rt.rs:165
#24 0x000055555592ecbe in main ()
#25 0x00007ffff7443cd0 in ?? () from /usr/lib/libc.so.6
#26 0x00007ffff7443d8a in __libc_start_main () from /usr/lib/libc.so.6
#27 0x00005555557f6a25 in _start ()
```
Any advice would be appreciated.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file, test, or specific entry point is named. Start by reproducing the startup failure and tracing the initialization path that emits the anyhow error; done should make the diagnostic identify which file or persisted data caused the invalid JSON value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100