# Help with "Block error"

**URL:** <https://discourse.pijul.org/t/help-with-block-error/834>\
**Category:** Question\
**Created:** [December 21, 2021, 7:14pm UTC](https://discourse.pijul.org/t/help-with-block-error/834 "2021-12-21T19:14:14Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 7:14pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/1 "2021-12-21T19:14:14Z")

</div>

Hi. I’m encountering an issue when I try to record a change. Namely, I get the error: “Error: Block error: Position { change: ChangeId(SOME\_VALUE), pos: ChangePosition(L64(9209)) }”. Here’s a reproduction:

```auto
$ pijul clone https://nest.pijul.com/nicoty/exercism_solutions
Downloading changes [==================================================] 11/11
           Applying [==================================================] 11/11
 Completing changes [] 0/0
$ cd exercism_solutions
$ # Add new files and directories to this local repository.
$ pijul add -r ./
$ pijul record
Password for "/home/a/.config/pijul/secretkey.json": # I then add patch message after entering the password.
Error: Block error: Position { change: ChangeId(SOME_VALUE), pos: ChangePosition(L64(9209)) }

```

Every time I run `pijul record`, the same error occurs but the “SOME\_VALUE” inside `ChangeId(SOME_VALUE)` changes. How do I fix this issue?

My system:

```auto
$ pijul --version
pijul 1.0.0-alpha.56
$ uname -a
Linux a 5.15.9_1 #1 SMP Thu Dec 16 17:16:21 UTC 2021 x86_64 GNU/Linux

```

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 21, 2021, 7:57pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/2 "2021-12-21T19:57:31Z")

</div>

Hi! Thanks for your report. We’re in the process of finishing up a full stable version (coming in the next few days/weeks), and there is a number of issues to tackle at the same time.

Is this from the latest Pijul from [nest.pijul.com/pijul/pijul](http://nest.pijul.com/pijul/pijul), or from [crates.io](http://crates.io)?

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 8:08pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/3 "2021-12-21T20:08:02Z")

</div>

[It’s from nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/version-management/pijul/default.nix#L36) which afaiu pulls from [crates.io](http://crates.io) (since the derivation uses the `fetchCrate` function).

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 21, 2021, 8:20pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/4 "2021-12-21T20:20:50Z")

</div>

If you can, trying the latest version out could solve this. If not, I’m interested by a bug report at [nest.pijul.com/pijul/pijul/discussions](http://nest.pijul.com/pijul/pijul/discussions)

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 8:30pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/5 "2021-12-21T20:30:48Z")

</div>

I’m trying to clone the repository so I can build the latest version, but I keep encountering an issue:

```auto
$ pwd
/home/.shared/repositories/pijul/pijul
$ pijul clone http://nest.pijul.com/pijul/pijul
Downloading changes [=>] 16/714
           Applying [=>] 16/714
Error: Changestore error: failed to fill whole buffer
$ pijul clone http://nest.pijul.com/pijul/pijul
Downloading changes [>] 13/714
           Applying [>] 13/714
Error: Changestore error: failed to fill whole buffer
$ pijul clone http://nest.pijul.com/pijul/pijul
Downloading changes [>] 6/714
           Applying [>] 6/714
Error: Changestore error: failed to fill whole buffer

```

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 21, 2021, 8:33pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/6 "2021-12-21T20:33:19Z")

</div>

I can’t reproduce. From what country are you trying to download this?

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 8:33pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/7 "2021-12-21T20:33:47Z")

</div>

I’m trying to download from the United Kingdom.

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 21, 2021, 8:35pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/8 "2021-12-21T20:35:05Z")

</div>

Same mirror as mine (but an older Pijul), I don’t really understand. An alternative you can try is via SSH. If you have an account on the Nest, and have uploaded your SSH key, you can do:

`pijul clone login@ssh.pijul.com/pijul/pijul`

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 21, 2021, 8:35pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/9 "2021-12-21T20:35:24Z")

</div>

Also, sorry for all these issues, I was expecting the final stages before the beta to be slightly smoother.

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 8:36pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/10 "2021-12-21T20:36:56Z")

</div>

Edit: Ah nevermind. I just tried it again and it worked this time. Now I’ll try to build it!

Original: Now I’m getting:

```auto
$ pijul clone nicoty@ssh.pijul.com/pijul/pijul
Password for key "id_ed25519":
Password for nicoty@ssh.pijul.com:
Downloading changes [============>] 172/714
           Applying [=========>] 135/714
Well, this is embarrassing.

pijul had a problem and crashed. To help us diagnose the problem you can send us a crash report.

We have generated a report file at "/tmp/report-6e39d602-d80f-4f0d-80d9-9a4ab0f148b5.toml". Submit an issue or email with the subject of "pijul Crash Report" and include the report as an attachment.

- Authors: Pierre-Étienne Meunier <pe@pijul.org>

We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports.
Downloading changes [============>] 180/714
           Applying [============>] 181/714
Error: Changestore error: No such file or directory (os error 2)
$ \cat /tmp/report-6e39d602-d80f-4f0d-80d9-9a4ab0f148b5.toml
name = 'pijul'
operating_system = 'unix:Unknown'
crate_version = '1.0.0-alpha.56'
explanation = '''
Panic occurred in file 'src/remote/ssh.rs' at line 491
'''
cause = 'called `Result::unwrap()` on an `Err` value: Error { kind: UnexpectedEof, message: "failed to fill whole buffer" }'
method = 'Panic'
backtrace = '''

   0: 0x55ff760c78a3 - core::result::unwrap_failed::hcd8e16a338c4f01c
   1: 0x55ff761b0db8 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h60aaf3fbdfa5310e
   2: 0x55ff7619b5a4 - thrussh::client::encrypted::<impl thrussh::client::Session>::client_read_authenticated::{{closure}}::h1a6260601126f021
   3: 0x55ff761c3181 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::he0465aecf708bfab
   4: 0x55ff761978ec - thrussh::client::Session::run::{{closure}}::h797987c5dee3ac8f
   5: 0x55ff7618e163 - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::h116c7101ed71368e
   6: 0x55ff7613aa89 - tokio::runtime::task::harness::Harness<T,S>::poll::h2a05342f8e5a505b
   7: 0x55ff765aa84f - std::thread::local::LocalKey<T>::with::h0c7b1c5fdfc1c774
   8: 0x55ff765a1d94 - tokio::runtime::thread_pool::worker::Context::run_task::h203fd8e5f4744edb
   9: 0x55ff765a1072 - tokio::runtime::thread_pool::worker::Context::run::h9a6fd49abd63d0dc
  10: 0x55ff765afb15 - tokio::macros::scoped_tls::ScopedKey<T>::set::ha42f6f4e5b527027
  11: 0x55ff765a0bfc - tokio::runtime::thread_pool::worker::run::h7f50cfe718fc70ed
  12: 0x55ff765912ef - tokio::loom::std::unsafe_cell::UnsafeCell<T>::with_mut::he355a39d8d000d65
  13: 0x55ff765949f8 - tokio::runtime::task::harness::Harness<T,S>::poll::h6df38a78aaa237e3
  14: 0x55ff7658ab62 - tokio::runtime::blocking::pool::Inner::run::h32c4f8553799fa85
  15: 0x55ff765adbde - std::sys_common::backtrace::__rust_begin_short_backtrace::h6e34c645afcd62ae
  16: 0x55ff765ae268 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hcf6441e9d6bbced6
  17: 0x55ff769469c3 - std::sys::unix::thread::Thread::new::thread_start::h0ad17abd9105a960
  18: 0x7f9cd4a8ed3e - start_thread
  19: 0x7f9cd487343f - __clone
  20: 0x0 - <unresolved>'''
$

```

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 21, 2021, 9:01pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/11 "2021-12-21T21:01:14Z")

</div>

I seem to be encountering the same issue even when using the latest version from the repo:

```auto
$ pwd
/home/.shared/repositories/pijul/pijul/pijul
$ pijul log | \cat
Change SH2ZBSAZNP3K5F5H7H5LJJUP3F2T4VKA53WLKJMQJ5CRRWU733JQC
Author: DoQo9ZrP1CpCvMB8Qd6CNunvTAQYuQEveQurCvnhcW7M
Date: 2021-12-20 14:47:45.602405764 UTC

    Fix typo in flake.nix defaultPackage

# Rest of the log ommitted.
$ nix-shell

[nix-shell:/home/.shared/repositories/pijul/pijul/pijul]$ cd /home/.shared/projects/exercism_solutions

[nix-shell:/home/.shared/projects/exercism_solutions]$ pijul record
Password for "/home/a/.config/pijul/secretkey.json":
Error: Block error: Position { change: ChangeId(SHJNOYSACDTXQ), pos: ChangePosition(L64(9209)) }

[nix-shell:/home/.shared/projects/exercism_solutions]$

```

I’m assuming that running `nix-shell` from the directory of the local repository will build pijul and expose it in my $PATH (replacing the old version), allowing me to use that latest version in that shell. Is that correct?

---

<div class="post-metadata">

**Author:** ![Rohan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rohan/32/99_2.png) [@Rohan](https://discourse.pijul.org/u/Rohan)\
**Post date:** [December 22, 2021, 2:03am UTC](https://discourse.pijul.org/t/help-with-block-error/834/12 "2021-12-22T02:03:46Z")

</div>

`nix-shell` won’t but the new flake-based `nix shell` will

---

<div class="post-metadata">

**Author:** ![Rohan](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/rohan/32/99_2.png) [@Rohan](https://discourse.pijul.org/u/Rohan)\
**Post date:** [December 22, 2021, 2:09am UTC](https://discourse.pijul.org/t/help-with-block-error/834/13 "2021-12-22T02:09:11Z")

</div>

Note that the Cargo.nix was outdated for me so you’ll also need to…

```auto
nix develop
cargo check
crate2nix generate

```

---

<div class="post-metadata">

**Author:** ![pmeunier](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/pmeunier/32/4_2.png) [@pmeunier](https://discourse.pijul.org/u/pmeunier)\
**Post date:** [December 22, 2021, 6:44am UTC](https://discourse.pijul.org/t/help-with-block-error/834/14 "2021-12-22T06:44:38Z")

</div>

@nicoty: can you clone your repository anew, and start from that clone? There is a possibility that the version you used corrupted the repo, cloning should fix that.

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 22, 2021, 11:49am UTC](https://discourse.pijul.org/t/help-with-block-error/834/15 "2021-12-22T11:49:20Z")

</div>

I still seem to be encountering the same issue in spite of doing your suggestions:

```auto
$ pijul clone nicoty@ssh.pijul.com/pijul/pijul
Password for key "id_ed25519":
Password for nicoty@ssh.pijul.com:
Downloading changes [==================================================] 714/714
           Applying [==================================================] 714/714
 Completing changes [] 0/0
$ cd pijul
$ pijul log | \cat
Change SH2ZBSAZNP3K5F5H7H5LJJUP3F2T4VKA53WLKJMQJ5CRRWU733JQC
Author: DoQo9ZrP1CpCvMB8Qd6CNunvTAQYuQEveQurCvnhcW7M
Date: 2021-12-20 14:47:45.602405764 UTC

    Fix typo in flake.nix defaultPackage

# Rest of the log ommitted.
$ nix --extra-experimental-features nix-command --extra-experimental-features flakes develop
bash-5.1$ cargo check
    Updating crates.io index
# Rest of output ommitted.
    Checking pijul v1.0.0-alpha.56 (/home/.shared/repositories/pijul/pijul/pijul/pijul)
warning: field is never read: `tags`
   --> pijul/src/remote/mod.rs:190:5
    |
190 | pub tags: HashSet<Merkle>,
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(dead_code)]` on by default

warning: `pijul` (bin "pijul") generated 1 warning
    Finished dev [unoptimized + debuginfo] target(s) in 6m 33s
bash-5.1$ crate2nix generate
Generated ./Cargo.nix successfully.
bash-5.1$ nix --extra-experimental-features nix-command --extra-experimental-features flakes shell
bash-5.1$ cd /home/.shared/projects
bash-5.1$ \rm -fr exercism_solutions
bash-5.1$ pijul clone nicoty@ssh.pijul.com/nicoty/exercism_solutions
Password for key "id_ed25519":
Password for nicoty@ssh.pijul.com:
Downloading changes [==================================================] 11/11
           Applying [==================================================] 11/11
 Completing changes [] 0/0
bash-5.1$ cd exercism_solutions
bash-5.1$ # Add new files and directories to this local repository.
bash-5.1$ pijul add -r ./
bash-5.1$ pijul record
Password for "/home/a/.config/pijul/secretkey.json": # Add patch message after entering the password here.
Error: Block error: Position { change: ChangeId(MDWMGOT7CFGZC), pos: ChangePosition(L64(9209)) }
bash-5.1$

```

---

<div class="post-metadata">

**Author:** ![spacefrogg](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.pijul.org/spacefrogg/32/37_2.png) [@spacefrogg](https://discourse.pijul.org/u/spacefrogg)\
**Post date:** [December 22, 2021, 1:28pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/16 "2021-12-22T13:28:18Z")

</div>

I can confirm, that there is _some_ problem.

Using the current version of pijul (built with `nix` from the Nest).

```auto
$ pijul clone https://nest.pijul.com/nicoty/exercism_solutions
Error: No such file or directory (os error 2)
$ pijul clone ssh://...@ssh.pijul.com/nicoty/exercism_solutions
# works fine

```

Cloning pijul/pijul via https works fine.

I was able to record patches in `exercism_solutions`, though.

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 22, 2021, 4:07pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/17 "2021-12-22T16:07:36Z")

</div>

I just discovered something. The issue occurs if I do these steps:

- `pijul clone` the repo.
- Add new files and directories to the local repo.
- `pijul add -r ./` the new files and directories.
- `pijul record` a patch.

Or if I do:

- `pijul clone` the repo.
- `pijul record` a patch.
- Add new files and directories to the local repo.
- `pijul add -r ./` the new files and directories.
- `pijul record --amend` the previous patch.

But it doesn’t occur if I do the following instead:

- `pijul clone` the repo.
- `pijul record` a patch.
- Add new files and directories to the local repo.
- `pijul add -r ./` the new files and directories.
- `pijul record` another patch.

How should we move forward with this new information in mind?

---

<div class="post-metadata">

**Author:** ![nicoty](https://avatars.discourse-cdn.com/v4/letter/n/8e8cbc/32.png) [@nicoty](https://discourse.pijul.org/u/nicoty)\
**Post date:** [December 23, 2021, 1:58pm UTC](https://discourse.pijul.org/t/help-with-block-error/834/18 "2021-12-23T13:58:12Z")

</div>

I’ve ended up initialising a new repository and replaying the patchset from the older repository. I no longer seem to encounter the issue with this new repository and I’d like to use [nicoty/exercism\_solutions](https://nest.pijul.com/nicoty/exercism_solutions) for it, so I’ve reuploaded the problematic repository to [nicoty/exercism\_solutions\_bugged](https://nest.pijul.com/nicoty/exercism_solutions_bugged) for posterity. I hope that’s ok.
