SyncError("Fetching remote data failed (KeyError): (b'core',)") #11364

Closed
opened 2025-12-29 21:44:12 +01:00 by adam · 7 comments
Owner

Originally created by @TravAJohn on GitHub (Jul 9, 2025).

Deployment Type

Self-hosted

NetBox Version

v4.3.3

Python Version

3.11

Steps to Reproduce

  1. Under Data Sources select sync
  2. Review job status under jobs
  3. Observe error output

Expected Behavior

The config template sync job should complete without an error

Observed Behavior

When I run sync on a Data Source I get the following error:
SyncError("Fetching remote data failed (KeyError): (b'core',)")

I also ran /opt/netbox/netbox/manage.py syncdatasource --all --traceback on the backend and this is the resulting stacktrace:

[1] Syncing netbox-config-templates... Traceback (most recent call last):
File "/opt/netbox/netbox/core/data_backends.py", line 118, in fetch
porcelain.clone(self.url, local_path.name, **clone_args)
File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/porcelain.py", line 581, in clone
(client, path) = get_transport_and_path(source, config=config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/client.py", line 3023, in get_transport_and_path
return SSHGitClient(hostname, username=username, config=config, **kwargs), path
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/client.py", line 2146, in init
config_ssh_command = config.get((b"core",), b"sshCommand")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/config.py", line 342, in get
return self._values[(section[0],)][name]
~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/config.py", line 116, in getitem
return self._keyed[lower_key(item)]
~~~~~~~~~~~^^^^^^^^^^^^^^^^^
KeyError: (b'core',)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/netbox/netbox/manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 442, in execute_from_command_line
utility.execute()
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 416, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 460, in execute
output = self.handle(*args, **options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/netbox/netbox/core/management/commands/syncdatasource.py", line 43, in handle
raise e
File "/opt/netbox/netbox/core/management/commands/syncdatasource.py", line 38, in handle
datasource.sync()
File "/opt/netbox/netbox/core/models/data.py", line 182, in sync
with backend.fetch() as local_path:
File "/usr/local/lib/python3.11/contextlib.py", line 137, in enter
return next(self.gen)
^^^^^^^^^^^^^^
File "/opt/netbox/netbox/core/data_backends.py", line 120, in fetch
raise SyncError(_("Fetching remote data failed ({name}): {error}").format(name=type(e).name, error=e))
core.exceptions.SyncError: Fetching remote data failed (KeyError): (b'core',)

This looks to be something related to the Dulwich plugin but I'm not 100% sure. I did also add a .gitconfig file to my netbox user's home dir with:
[core]
sshCommand = ssh

but this didn't change the observed behavior.

Originally created by @TravAJohn on GitHub (Jul 9, 2025). ### Deployment Type Self-hosted ### NetBox Version v4.3.3 ### Python Version 3.11 ### Steps to Reproduce 1. Under Data Sources select sync 2. Review job status under jobs 3. Observe error output ### Expected Behavior The config template sync job should complete without an error ### Observed Behavior When I run sync on a Data Source I get the following error: SyncError("Fetching remote data failed (KeyError): (b'core',)") I also ran /opt/netbox/netbox/manage.py syncdatasource --all --traceback on the backend and this is the resulting stacktrace: [1] Syncing netbox-config-templates... Traceback (most recent call last): File "/opt/netbox/netbox/core/data_backends.py", line 118, in fetch porcelain.clone(self.url, local_path.name, **clone_args) File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/porcelain.py", line 581, in clone (client, path) = get_transport_and_path(source, config=config, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/client.py", line 3023, in get_transport_and_path return SSHGitClient(hostname, username=username, config=config, **kwargs), path ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/client.py", line 2146, in __init__ config_ssh_command = config.get((b"core",), b"sshCommand") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/config.py", line 342, in get return self._values[(section[0],)][name] ~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.11/site-packages/dulwich/config.py", line 116, in __getitem__ return self._keyed[lower_key(item)] ~~~~~~~~~~~^^^^^^^^^^^^^^^^^ KeyError: (b'core',) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/netbox/netbox/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line utility.execute() File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 416, in run_from_argv self.execute(*args, **cmd_options) File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/base.py", line 460, in execute output = self.handle(*args, **options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/core/management/commands/syncdatasource.py", line 43, in handle raise e File "/opt/netbox/netbox/core/management/commands/syncdatasource.py", line 38, in handle datasource.sync() File "/opt/netbox/netbox/core/models/data.py", line 182, in sync with backend.fetch() as local_path: File "/usr/local/lib/python3.11/contextlib.py", line 137, in __enter__ return next(self.gen) ^^^^^^^^^^^^^^ File "/opt/netbox/netbox/core/data_backends.py", line 120, in fetch raise SyncError(_("Fetching remote data failed ({name}): {error}").format(name=type(e).__name__, error=e)) core.exceptions.SyncError: Fetching remote data failed (KeyError): (b'core',) This looks to be something related to the Dulwich plugin but I'm not 100% sure. I did also add a .gitconfig file to my netbox user's home dir with: [core] sshCommand = ssh but this didn't change the observed behavior.
adam added the type: bug label 2025-12-29 21:44:12 +01:00
adam closed this issue 2025-12-29 21:44:12 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 10, 2025):

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Jul 10, 2025): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@github-actions[bot] commented on GitHub (Jul 18, 2025):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Jul 18, 2025): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Author
Owner

@TravAJohn commented on GitHub (Jul 18, 2025):

Steps to reproduce this error:

  1. After logging into netbox, open the "Operations" menu in the sidebar
  2. select the "Data Sources" section
  3. select the already created git type data source
  4. in the upper right corner next to "Bookmark" select the "Sync" button
  5. while the job is queued, navigate to the "Jobs" tab for your data source
  6. select the job you just ran which should be at the top of the list
  7. review job status
  8. the job has a status of "Errored"
  9. The Error section under status of the jobs has the error message: "SyncError("Fetching remote data failed (KeyError): (b'core',)")
Image

"

@TravAJohn commented on GitHub (Jul 18, 2025): Steps to reproduce this error: 1. After logging into netbox, open the "Operations" menu in the sidebar 2. select the "Data Sources" section 3. select the already created git type data source 4. in the upper right corner next to "Bookmark" select the "Sync" button 5. while the job is queued, navigate to the "Jobs" tab for your data source 6. select the job you just ran which should be at the top of the list 7. review job status 8. the job has a status of "Errored" 9. The Error section under status of the jobs has the error message: "SyncError("Fetching remote data failed (KeyError): (b'core',)") <img width="1619" height="589" alt="Image" src="https://github.com/user-attachments/assets/89073fdf-31cd-4f99-b46d-ac4257e24e77" /> "
Author
Owner

@arthanson commented on GitHub (Jul 28, 2025):

@TravAJohn This does not reproduce for me, it may be the specific git data source you are going to. I used this GitHub repository for testing (https://github.com/bogdancordos/netbox_scripts.git) and the sync worked fine. Can you please try this or another git data source for a test and see if that works. If it doesn't it points to a potential configuration issue or something specific to your installation.

If the other git url works, then it is something specific to the git repository you are syncing to. I'd compare it to the other repository and see if there are differences between the two.

the error you are seeing is from the Dulwich library. I'd first make sure it is up to date and if not install the latest version and try that. Also, is there possibly a 'core' directory or other named item in your git repository? It might be trying to look at that and if so you can double-check that item in your repository and see if there is a configuration issue with that.

Also, I'd suggest opening this as a discussion to see if the broader community has other ideas.

@arthanson commented on GitHub (Jul 28, 2025): @TravAJohn This does not reproduce for me, it may be the specific git data source you are going to. I used this GitHub repository for testing (https://github.com/bogdancordos/netbox_scripts.git) and the sync worked fine. Can you please try this or another git data source for a test and see if that works. If it doesn't it points to a potential configuration issue or something specific to your installation. If the other git url works, then it is something specific to the git repository you are syncing to. I'd compare it to the other repository and see if there are differences between the two. the error you are seeing is from the Dulwich library. I'd first make sure it is up to date and if not install the latest version and try that. Also, is there possibly a 'core' directory or other named item in your git repository? It might be trying to look at that and if so you can double-check that item in your repository and see if there is a configuration issue with that. Also, I'd suggest opening this as a discussion to see if the broader community has other ideas.
Author
Owner

@TravAJohn commented on GitHub (Jul 29, 2025):

@arthanson Thanks for the suggestions. We're using Azure DevOps but I can test out our local Gitea instance to see if the behavior changes. I'll report back with my results and open a discussion if I'm still seeing this issue.

@TravAJohn commented on GitHub (Jul 29, 2025): @arthanson Thanks for the suggestions. We're using Azure DevOps but I can test out our local Gitea instance to see if the behavior changes. I'll report back with my results and open a discussion if I'm still seeing this issue.
Author
Owner

@TravAJohn commented on GitHub (Jul 31, 2025):

@arthanson @jeremystretch I was able to resolve this by updating the Dulwich plugin from v0.23.0 to v0.23.2. My best estimation on this is that is was something in the version of dulwich we were running prior to upgrading.

@TravAJohn commented on GitHub (Jul 31, 2025): @arthanson @jeremystretch I was able to resolve this by updating the Dulwich plugin from v0.23.0 to v0.23.2. My best estimation on this is that is was something in the version of dulwich we were running prior to upgrading.
Author
Owner

@jeremystretch commented on GitHub (Aug 1, 2025):

@TravAJohn interesting. Thank you for following up with your fix!

@jeremystretch commented on GitHub (Aug 1, 2025): @TravAJohn interesting. Thank you for following up with your fix!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11364