# Nix darwin not rebuilding: "error looking up directory - object not found"

**URL:** https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927
**Category:** Help
**Created:** [February 27, 2025, 1:15am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927 "2025-02-27T01:15:04Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [February 27, 2025, 1:15am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/1 "2025-02-27T01:15:04Z")

</div>

I can’t rebuild from flake on nix-darwin, there seems to be an issue fetching other flakes.

I get an error like:

```auto
error: looking up directory '«github:nix-community/poetry2nix/026858e4700f0e1cc5cf4d2b9a1ae11c41ab88be?narHash=sha256-/HGpq4yVSH7tHMBnTeCNUbfLuzYLLRRtvqNzDAP1d8k%3D»/.github': object not found - no match for id (ac0f9caeea0b8caacb308c9858364557ab08029b)

```

The poetry2nix flake is in my configuration, however if I remove any poetry2nix references, it’ll fail on the next flake that’s used.

I suspected this was a cryptic error for a GitHub API limit, but I have added `access-tokens = github.com=<token>` to both my configuration.nix (under nix.extraOptions), and in `/etc/nix.conf` and there is no change.

For what it’s worth, the same flake builds find on NixOs (with a very similar configuration).

I’m not sure how to proceed.

Many thanks for any help.

---

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [February 27, 2025, 1:36am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/2 "2025-02-27T01:36:12Z")

</div>

> <https://github.com/NixOS/nix/issues/9820>
>
> \*\*Describe the bug\*\*
> 
> Adding a \`git+file:\` input to a flake which refers to a …repository which was cloned shallowly results in an error of the form:
> \`\`\`
> error:
> … while updating the lock file of flake 'git+file:///path/to/flake'
> 
> … while updating the flake input 'nixpkgs'
> 
> … while fetching the input 'git+file:///tmp/nixpkgs?shallow=1'
> 
> error: getting parent of Git commit '9fe5cee74762d8687c11151e2dfb88c77ac0b5d4': object not found - no match for id (2e7eed72914de2d0d4d38e4d545ca26702dba818)
> \`\`\`
> In Nix 2.19.3 and before it works correctly.
> 
> \*\*Steps To Reproduce\*\*
> 
> 1. Shallow-clone a git repository, e.g. \`git clone https://github.com/NixOS/nixpkgs --depth=1 /tmp/nixpkgs\`.
> 2. Make a flake that uses that repository as an input, with or without \`?shallow=1\`, e.g.:
> \`\`\`nix
> {
> inputs.nixpkgs.url = "git+file:///tmp/nixpkgs";
> outputs = { self, nixpkgs }: { };
> }
> \`\`\`
> 3. Run \`nix flake update\` in that flake directory
> 
> \*\*Expected behavior\*\* — Behavior on Nix 2.9.2:
> 
> The flake updates and locks successfully, outputting \`Added input 'nixpkgs': git+file:///tmp/nixpkgs?ref…\` (etc)
> 
> \*\*\`nix-env --version\` output\*\*
> \`nix-env (Nix) 2.19.0pre20231031\_ee36a44\`
> 
> \*\*Additional context\*\*
> 
> Bisect points to ee36a44bf272c8cca62a2ce96a017a8150c4d35b from #9240.
> 
> \*\*Priorities\*\*
> 
> Add :+1: to \[issues you find important\](https://github.com/NixOS/nix/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc).

Seems similar, you may be able to fix this by upgrading your nix version.

---

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [February 27, 2025, 2:06am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/3 "2025-02-27T02:06:44Z")

</div>

Hmm, I’m on 2.24.18, so I don’t think my nix-version is the issue.

Thanks for responding.

---

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [February 27, 2025, 3:14am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/4 "2025-02-27T03:14:57Z")

</div>

2.24.18 … [doesn’t exist](https://github.com/NixOS/nix/tags)?

Nix has been an absolute shitshow this year, I would try with 2.18.8, 2.24.11 (not 2.24.12, since that had some regressions related to fetching flake inputs), 2.26.2, or even lix, see which one of those works.

Due to all the recent regressions I’m 99% sure it’s the nix version, especially since it works on one machine but not another.

---

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [February 27, 2025, 7:55am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/5 "2025-02-27T07:55:24Z")

</div>

Sorry, 2.24.12!

Okay, thank you, I will try 2.24.11. Thanks for your help.

---

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [February 27, 2025, 8:32am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/6 "2025-02-27T08:32:02Z")

</div>

I’ve tried with both 2-24-11 and 2-18-8.

I installed them with `nix-env -iA`, because I can’t rebuild my flake at the moment.

I get:

```shell
❯ nix --version
nix (Nix) 2.18.8

```

But the same issue persists when I try to rebuild.

EDIT: tried 2.23.4, too, the version on my NixOS machine.

---

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [February 28, 2025, 11:34pm UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/7 "2025-02-28T23:34:12Z")

</div>

For what it’s worth, I never discovered the issue, I tried numerous nix versions. In the end I had to fully install nix and start from scratch. Nix.

---

<div class="post-metadata">

### Author: ![waffle8946](https://discourse.nixos.org/user_avatar/discourse.nixos.org/waffle8946/32/27221_2.png) [@waffle8946](https://discourse.nixos.org/u/waffle8946)
#### Post date: [March 1, 2025, 3:00am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/8 "2025-03-01T03:00:18Z")

</div>

> [@holden-c](#):
>
> I installed them with `nix-env -iA`,

Definitely don’t use `nix-env`… `nix-shell -p` or `nix shell` would’ve been better.

> [@holden-c](#):
>
> In the end I had to fully install nix and start from scratch. Nix.

I mean… software has bugs sometimes, that’s unavoidable with any software. Though I forgot to mention, deleting `~/.cache/nix` may have helped if it was some bug that resulted in a broken cache. In any case, good thing you were able to resolve it.

---

<div class="post-metadata">

### Author: ![holden-c](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/h/dec6dc/32.png) [@holden-c](https://discourse.nixos.org/u/holden-c)
#### Post date: [March 1, 2025, 10:32am UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/9 "2025-03-01T10:32:54Z")

</div>

> deleting `~/.cache/nix`

Why didn’t I do that!? Thanks for the advice.

---

<div class="post-metadata">

### Author: ![ElNixOsMasHermoso](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/e/dfb087/32.png) [@ElNixOsMasHermoso](https://discourse.nixos.org/u/ElNixOsMasHermoso)
#### Post date: [December 12, 2025, 9:12pm UTC](https://discourse.nixos.org/t/nix-darwin-not-rebuilding-error-looking-up-directory-object-not-found/60927/10 "2025-12-12T21:12:37Z")

</div>

I ran into the same issue and deleted the cache resolved it! TY
