Box CLI suddenly throws Object reference not set error

回答済み
新規投稿

コメント

2件のコメント

  • The_Kid

    OK so I was able to solve this issue with additional trial-and-error. To begin with, the issue seems to have been caused by a corruption of the Box CLI config files found in the user settings folder. These files get automatically generated by Box CLI the first time a user runs a Box command. I believe the issue was due to me being logged into multiple Windows sessions where in both session Box CLI was being accessed at the same time. This seemed to cause a corruption in the config files.

     

    What I did to fix this issue was the following:

     

    • Navigated to c:\Users\{username}\AppData\.box
      • Note the .box is the folder where CLI generates and maintains the config files, token cache, etc
    • In this folder were 3 files: box_environments.jsoncache.json and settings.json
    • moved (i.e. not deleted) these files to a temp folder.
    • I opened a command prompt and ran a simple box command. In this case I just typed in box -h. This triggered CLI to regenerate these files AND (most importantly) the error I was seeing was no longer there. (Yay!)
      • Note that this does wipe out your environments and settings (e.g. downloads folder) so you can either manually recreate these in the Box CLI or try copying back in the config files you moved in the third step above. The problem is that if you copy in the same files you might end up bringing back the same error you started out with. What I did was first copy the box_environments.json and then retried a box command (e.g. box folders list-items 0). That worked for me. The next thing was that I copied back in was the settings.json file and retried. That's when I received the error (so that was basically the file that got pooched). I didn't bother copying back the cache as it simply stores the token and Box CLI will automatically get a new one anyways.

    Two important lessons learned:

    • Two separate Windows user sessions (with the same user logged in) concurrently running Box commands will both access the same .box setting files and will run the chance of corrupting these files. Careful--especially if you are running any Box commands through the same Windows service account in multiple services/processes/etc.
    • Even when Box CLI is cleanly uninstalled it does not remove any of the user AppData, this will need to be manually fixed.
    0
    コメントアクション パーマリンク
  • sgarlanka

    How would I fix this issue on macOS Sierra?

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。