Skip to content

The reference at "HEAD" could not be instantiated: Reference name cannot start with a dot #1743

Closed

Description

@spenserblack

Duplicates

  • I have searched the existing issues

Current behavior 😯

one such weakness of onefetch is this:

> onefetch
Error: Failed to traverse Git commit history

Caused by:
    0: The reference at "HEAD" could not be instantiated
    1: The path "refs/heads/.invalid" to a symbolic reference within a ref file is invalid
    2: Reference name cannot start with a dot
> git refs migrate --ref-format=files
> onefetch --no-art -d pending
groutoutlook ~ git version 2.53.0.windows.3
-------------------------------------------
Project: onefetch (1 branch)
Description: Command-line Git information tool
HEAD: 8d4e4c8 (main, origin/main)
Version: 2.27.1
Created: 21 hours ago
Languages:
           ● Rust (97.3 %) ● Shell (2.1 %)
           ● Makefile (0.4 %) ● Ruby (0.2 %)
Dependencies: 23 (Cargo)
Author: 100% dependabot[bot] 1
Last change: 21 hours ago
URL: https://github.com/o2sh/onefetch
Commits: 1 (shallow)
Churn (1): .gitignore 1
           …/git/metrics.rs 1
           …/info/head.rs 1
Lines of code: 5417
Size: 2.06 MiB (130 files)
License: MIT
# output here.

Core issue is onefetch still a git tool and lots of thing dependent on libgit2 have to finish migrating to reftable backend first.

Expected behavior 🤔

Successful execution

Steps to reproduce 🕹

N/A

Additional context/Screenshots 🔦

Bringing over this bug report I got in spenserblack/gengo#680 (comment)

cc @groutoutlook

Possible Solution 💡

No response

Activity

  1. spenserblack commented on May 7, 2026

    @spenserblack
    CollaboratorAuthor

    @Byron Could this be an issue gix could/should resolve? Looks like this may be related to Windows. Are you familiar with the refs/heads/.invalid file? Assuming that's the actual filename and not an example, looks like it could be an intentionally invalid file that git's plumbing would create?

    Just wanted to make you aware. IDK if there's anything that actually should be done on gix's side.

  2. Byron commented on May 7, 2026

    @Byron
    Collaborator

    Git marks HEAD with an invalid value when the reftable backend is used to fail older clients early.

    Support for this is planned to land in gitoxide before September this year to be Git3 ready.

    There is nothing that can be done to workaround it, unless one would want to have a git executable fallback to read refs for these cases. Maybe it's just one call anyway?

  3. spenserblack commented on May 7, 2026

    @spenserblack
    CollaboratorAuthor

    There is nothing that can be done to workaround it, unless one would want to have a git executable fallback to read refs for these cases. Maybe it's just one call anyway?

    Probably best to just leave it alone, then. It looks like the user was able to fix their issue with git refs migrate --ref-format=files, so perhaps a simple solution could be to detect the error type and offer that as a suggestion?

  4. Byron commented on May 7, 2026

    @Byron
    Collaborator

    Probably.
    But once the error is detected, it would be as easy to try to use git, but only if onefetch really is only interested in a single ref to keep it easy and fast.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions