finicky icon indicating copy to clipboard operation
finicky copied to clipboard

Finicky cannot find config file

Open alexbelyeu opened this issue 7 months ago • 12 comments

⚠️ Please note that only Finicky 4 is being actively developed and maintained, bugs in Finicky 3 and below won't be fixed

Describe the bug I have finicky.js config file that lives in: ~/.finicky.js (ie: Users/my_user/.finicky.js). It seems like Finicky is not finding it and the logs show that it's looking for it in /var/root/.finicky.js. Am I doing something wrong? Please let me know if I can provide more details.

Image

Your configuration Finicky version: 4.0.0 (9c1f2d1, built 2025-05-13 18:34:11 UTC) Configuration is very basic, not the source of the issue.

To Reproduce Steps to reproduce the behavior:

  1. Go to any URL
  2. Defaults to Safari.
  3. Check logs and see that it cannot find config file

alexbelyeu avatar May 15 '25 16:05 alexbelyeu

Hm. There's an alternative way we could try to get the user home dir if it's not working for you. If you wouldn't mind, could you copy all of the logs (use the copy logs button) and reply with them here?

I'm curious. If you open a terminal and run echo $HOME, what does that command output? For me it prints my home directory, e.g. /Users/johnste

johnste avatar May 15 '25 18:05 johnste

It's weird because I installed this two days ago, and I have had the issue come and go. I have it working now, but I haven't really touched anything to make it work. Maybe it reloaded or something and it worked. Once it happens again, I will post the full logs here! Thank you for being so responsive 🙏 PS: Yeah, my $HOME shows the same with my user.

alexbelyeu avatar May 15 '25 19:05 alexbelyeu

Hi! I'm seeing this happening again after a few days. Here are the logs:

[2025-05-19T17:36:31.671Z] [INFO ] Starting Finicky | version: 4.0.0
[2025-05-19T17:36:31.685Z] [WARN ] Logging requests to disk. Logs may include sensitive information. Disable this by setting logRequests: false.
[2025-05-19T17:36:31.685Z] [WARN ] Failed to setup file logging | Error: failed to create log directory: mkdir /var/root/Library: permission denied
[2025-05-19T17:36:31.685Z] [ERROR] failed to read config: no config file found in any of these locations: /var/root/.finicky.js, /var/root/.finicky.ts, /var/root/.config/finicky.js, /var/root/.config/finicky.ts, /var/root/.config/finicky/finicky.js, /var/root/.config/finicky/finicky.ts
[2025-05-19T17:36:31.685Z] [INFO ] Listening for events...
[2025-05-19T17:36:31.696Z] [ERROR] Error creating cache directory | Error: mkdir /var/root/Library: permission denied
[2025-05-19T17:36:31.696Z] [INFO ] Checking for updates...
[2025-05-19T17:36:31.825Z] [INFO ] URL received | url: https://xxxx
[2025-05-19T17:36:31.825Z] [WARN ] No configuration available, using default configuration
[2025-05-19T17:36:31.825Z] [INFO ] Starting browser | name: com.apple.Safari | url: https://xxxx
[2025-05-19T17:36:32.974Z] [ERROR] Error creating cache directory | Error: mkdir /var/root/Library: permission denied

alexbelyeu avatar May 19 '25 17:05 alexbelyeu

I've had a look tonight to try to figure this out. Could you somehow be running the app as root? I don't know why this would happen. If you can find any pattern to when this happens it would be useful, but as Finicky's using the standard methods of getting the home directory, I'm not sure what I can do about it.

johnste avatar May 26 '25 18:05 johnste

I'm using my work laptop, and I think the one pattern I'm finding is when I have to authenticate via WARP Cloudflare (a sort of VPN). So the flow is: 1. I click the logo on the top menu bar, which should lead me to the Cloudflare website to log in. 2. This gets confused and cannot load Finicky.

However, after some time it kinda "fixes" itself and then starts working. I think I have only seen this break in this way. I think there might be something in the way this is accessing the link that is messing with it.

All this said, I think I can just be careful about how I log into Cloudflare here, but I'm not seeing it break in other places consistently. If I do, I can report back. If you want to close this ticket, I'm totally ok with that too!

alexbelyeu avatar May 28 '25 00:05 alexbelyeu

I'm having a similar issue when using a mobile router (similar to https://consumer.huawei.com/ie/routers/mobile-wifi-3s/ ). When the device gets connected to the computer, it will automatically open the login page in a browser, presumable as root, which causes the same error message as shown in this issue.

samcarter avatar May 30 '25 08:05 samcarter

Did you experience this issue in Finicky 3.4.0?

johnste avatar May 30 '25 08:05 johnste

I only started using finicky with version 4.

I just tried to download the old version, but get an error Configuration: SyntaxError: Unexpected keyword 'export'

Can I see a sample config for 3.4.0 somewhere?

samcarter avatar May 30 '25 09:05 samcarter

@samcarter Finicky 3 config is similar to 4 but has a few small differences. You could try using the old Finicky Kickstart tool to generate one.

module.exports = {
  defaultBrowser: "Safari",      
  handlers: [
    {
      match: /^https?:\/\/google\.com\/.*$/,
      browser: "Safari"
    }
  ]
}

johnste avatar May 30 '25 09:05 johnste

Thanks! I'm going to test tonight when I'm near that problematic device.

samcarter avatar May 30 '25 09:05 samcarter

Since Finicky 3.4 launches on demand and keeps on running, this issue, if it also affects 3.4, should happen less.

Will need to think about this - and try to find a reproduction so I can debug it.

johnste avatar May 30 '25 09:05 johnste

I can confirm that the problem does not occur with 3.4

samcarter avatar May 30 '25 18:05 samcarter

I'm also experiencing this issue on finicky v4.1.2. Also on a work laptop that uses Cloudflare WARP. Restarting finicky helps resolve the issue.

lyallcooper avatar Jun 06 '25 23:06 lyallcooper

Another related issue is that Finicky 4 no longer loads configs from custom locations (which Finicky 3 did).

Also see https://github.com/johnste/finicky/issues/441.

nisc avatar Jun 10 '25 13:06 nisc

Tried to reproduce the error by installing Cloudflare WARP, but I assume I'd need to enroll in some sort of company account to be able to repeat the same steps – I'm not getting a login prompt.

johnste avatar Jun 12 '25 21:06 johnste

Is someone here wiling and able to help me out?

I have made a test build (PR) that includes an alternative way of getting the user's home directory, but before I commit to refactoring large parts of the application, I would like to find out if this method works more reliably than the current solution.

  1. Download the Finicky-universal artifact zip from the action summary page of the PR
  2. Unzip and open the Finicky application inside. ⚠ The app isn't signed, so you need to right-click and select "open" to be able to run it
  3. Replace the existing Finicky app in /Applications with the new one
  4. Reproduce the issue where Finicky can't find the config due to looking in /var/root
  5. Go to the troubleshoot tab, enable debug logs and check the debug log Image
  6. Does this home directory correspond to the expected one? That is, not /var/root but the one for your user?

johnste avatar Jun 18 '25 20:06 johnste

@johnste Thanks for looking into this problem!

For my specific case with the login page of my mobile router, your PR works great and I get my personal home directory in the debug output.

samcarter avatar Jun 18 '25 20:06 samcarter

Oh great! I'll begin the work to use this information instead. It will require some work to refactor the application flow so it'll take a little bit of time to build and test. I'll keep this issue updated.

johnste avatar Jun 18 '25 20:06 johnste

@samcarter Would you mind testing this build to see if the issue remains? https://github.com/johnste/finicky/actions/runs/15833130376?pr=455

Similar instructions as the last one, just that this one should hopefully just use the correct folders, and there's no debug output

johnste avatar Jun 24 '25 06:06 johnste

@johnste Thanks for working on this! I will happily test (I currently don't have the problematic device with me, so might take until tonight or tomorrow)

samcarter avatar Jun 24 '25 07:06 samcarter

@johnste I'm terrible sorry, I think I messed up the testing.

I was testing the version from your comment https://github.com/johnste/finicky/issues/412#issuecomment-2998942771 and had the same /var/root/.finicky.js error as originally.

Then I went back to the version from https://github.com/johnste/finicky/issues/412#issuecomment-2985573002 , which originally worked for me, and it now has the same /var/root/.finicky.js error. I don't really know what is happing, the only explanation I can think of is that I maybe forgot to close the finicky window before connecting my device and it thus worked for me?

I'm terrible sorry if this sent you on the wrong track and wasted your time!

samcarter avatar Jun 25 '25 22:06 samcarter

@samcarter Ah, that is unfortunate. Don't worry about it though, these things happen. This does mean we need to find another angle at figuring this out.

johnste avatar Jun 27 '25 06:06 johnste

Would adding a last-resort search location in a user-independent folder help? Maybe something like /opt/finicky/ ?

samcarter avatar Jun 27 '25 15:06 samcarter

I found a couple of issues in my last approach. If you're still up for testing I'd be very interested in learning if this latest build https://github.com/johnste/finicky/actions/runs/15984289913?pr=455 works any better.

It works for me if I switch to the root account (sudo su) and then launch Finicky manually open -a /Applications/Finicky.app/, whereas the current release tries to find configuration in /var/root

johnste avatar Jun 30 '25 21:06 johnste

Wow, you are fantastic! The new version works great (and yes, I did double check that the config window was not still open - I even restarted the laptop to make sure there wasn't anything still running).

samcarter avatar Jun 30 '25 21:06 samcarter

Amazing! I'll clean this up a bit and release a new version soon. Thanks again for testing!

johnste avatar Jun 30 '25 21:06 johnste

Looking forward to the new release! Thank you so much for your patience to fix this!

samcarter avatar Jun 30 '25 22:06 samcarter