~Baffled~: TypeError: Notebook '@martien/cent' failed to load

Today, I ran into:

Notebook ‘@martien/cent’ failed to load

At first, I didn’t understand what was going on. Now I do. Here’s what I concluded.

Context

  • You are logged in.
  • Notebook ImporteR imports cell(s) from notebook ImporteD.
  • You own both notebooks.
ImporteD ImporteR Result
private private Imported notebook loads fine.
public private Imported notebook loads fine.
private public TypeError: Notebook 'ImporteD' failed to load
public public Imported notebook loads fine.

This does make sense:

If ImporteD is then
public any notebook can import its cells; i.e. share status of ImporteR is irrelevant
private only same owner can import it to avoid exposing cells from private notebooks

You got it. The technical detail is that when a public notebook imports something, it does so as an anonymous user. That even applies if it a “transitive import”.

So if you have notebook A that imports B, and then B imports C:

If A is private and B is public, then your import of notebook B will be done as “you”, with credentials. The import of C, since it originated from a public notebook, would be requested as if you were signed out.

This is partially due to security, as you point out. However, it’s also a matter of consistency. You should have a reasonable expectation that a notebook will look the same for anyone that can open it. If you could access private resources from public notebooks, it would be hard to be sure that what you are sharing with the word actually looks the way you expect.

1 Like