Skip to content

Fix PermissionError when checking template paths on shared filesystems#2252

Merged
krassowski merged 2 commits intojupyter:mainfrom
ctcjab:fix-permission-error
Jan 30, 2026
Merged

Fix PermissionError when checking template paths on shared filesystems#2252
krassowski merged 2 commits intojupyter:mainfrom
ctcjab:fix-permission-error

Conversation

@ctcjab
Copy link
Copy Markdown
Contributor

@ctcjab ctcjab commented Dec 3, 2025

Handle PermissionError that can occur when calling Path.exists() on template paths in _get_conf(). This issue can happen sporadically on shared/distributed filesystems (e.g., CephFS, NFS) due to:

  • Transient permission errors during metadata operations
  • Metadata cache coherency operations
  • Concurrent access to shared directories

The fix mirrors the existing PermissionError handling in _template_paths() (lines 576-577 and 584-585) by wrapping the exists() check in a try/except block to gracefully skip paths that cannot be accessed.

This resolves sporadic failures when running jupyter nbconvert in environments where JUPYTER_PATH contains shared filesystem directories.

Handle PermissionError that can occur when calling Path.exists() on
template paths in _get_conf(). This issue can happen sporadically on
shared/distributed filesystems (e.g., CephFS, NFS) due to:

- Transient permission errors during metadata operations
- Metadata cache coherency operations
- Concurrent access to shared directories

The fix mirrors the existing PermissionError handling in _template_paths()
(lines 576-577 and 584-585) by wrapping the exists() check in a try/except
block to gracefully skip paths that cannot be accessed.

This resolves sporadic failures when running jupyter nbconvert in
environments where JUPYTER_PATH contains shared filesystem directories.
@ctcjab
Copy link
Copy Markdown
Contributor Author

ctcjab commented Dec 3, 2025

The sole failing check is saying Select at least one triage label, but I don't seem to have permission to do that:

Screenshot 2025-12-03 at 4 42 53 PM

@krassowski krassowski added the bug label Jan 29, 2026
Copy link
Copy Markdown
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense, indeed in Python older than 3.14 this could happen, as documented here:

Image

https://docs.python.org/3/library/pathlib.html#querying-file-type-and-status

It is also in line with #2162

Comment thread nbconvert/exporters/templateexporter.py
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
@krassowski krassowski changed the title Fix PermissionError when checking template paths on shared filesystems Fix PermissionError when checking template paths on shared filesystems Jan 30, 2026
@krassowski krassowski merged commit ed3bcf8 into jupyter:main Jan 30, 2026
28 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants