Could not find an entry


I am one again asking for some help. In my last topic, I got some help simplifying my code to open files without batchPlay. This time, I have come across a different issue. I want to open up a file based on its path. I know the path is valid. The problem starts when I try to get the entry using getEntryWithUrl. For some reason, the code can’t find the path.
The error looks like this:

Error: Could not find an entry of {filePath}

In the error, it also replaces all the spaces and brackets with, what I am guessing is just an interpretation of the symbols in a different way, such as %5B or % just for space. Not sure if this is the problem but mentioning it just in case. My code:

async function openFile(filePath) {
    try {

        const fs = require('uxp').storage.localFileSystem;
        const file = await fs.getEntryWithUrl(`file:\\${filePath}`);
        const document = await;
    } catch (e) {

I run this code from another function, and that functions is run from executeAsModal;
My manifest permissions:

"requiredPermissions": {
    "allowCodeGenerationFromStrings": true,
    "launchProcess": {
      "schemes": [
      "extensions": [
    "localFileSystem" : "fullAccess",
    "clipboard": "readAndWrite",
    "webview": {
      "allow": "yes",
      "domains": [

I am at my wits end. Thanks in advance to anyone that decides to help

@M3mber there are few special chars which are not supported in paths, may be you have them in path and thats where its not working,

Can you try your openFile method on something in the desktop or in the plugin data folder, just to confirm if its path issue

Also, which platform is this.?
Path separators are different in mac and win, we recommend using the path module to combine paths if you need

I managed to fix it. The problem was in two places, from which one I get, the other one I don’t.
My first issue was this:

const document = await;

app was undefined, which is weird. I worked on this before and it didn’t say that before. I turned off my PC, went home and turned it on and now it finally mentioned it. This part I understand.

The second problem was with the actual opening. What happened is I didn’t use run executeAsModal on it directly. I ran in on a function that calls this one because I thought it would be fine. Does executeAsModal always have to be called on a function directly, or can I call it on a different function that then calls the one I need it for?

I’m not sure why your problem with the path got solved this way. Without knowing the details I would think it’s a red herring. You absolutely can call executeAsModal higher up in the call stack and then every subsequent function call will happen in the modal context until all calls return.

I am not quite sure either why it got solved and why it was showing me different issues before restarting the PC. The const app that I forgot to add is obvious, however as for the other one I hope this restart isn’t just a fluke and it goes back to not working. Maybe I somehow didn’t reload when debugging? There is tons of possibilities. All that matters to me is that it works. I will try to look further into why it didn’t work before. Thanks

Makes sense. One thing to keep an eye out for is ‘await’ statements. Not sure how familiar you are with async function calls, but the return of those would be promises. The ‘await’ waits for these promises to be fulfilled. Sometimes accidentally leaving out an ‘await’ can mean that you’re being passed a promise instead of an expected other object. These errors can be really hard to trace… I’m only mentioning this because it often produces red herrings as well, where the actual cause of the problem is in a completely different part of your code than the part where it first manifests.