Reading config value from OneDrive location in Server- when we change the config location in Asset direct OneDrive then it is working fine but if we give Server path where we have OneDrive location then getting issue of reading config file value

reading config value from OneDrive location in Server- when we change the config location in Asset direct OneDrive then it is working fine but if we give Server path where we have OneDrive location then getting issue of reading config file value, Error: Failed at initialization The given key ‘Xyz’ was not present in the dictionary.

Hi @Kumar_Chandrakant ,

This looks more like a file access/path issue than an actual missing Xyz key in the configuration.

Since the config works when the Asset points directly to the OneDrive location but fails when the Asset points to a server path containing the OneDrive-synced file, I would check the following:

  • Verify that the unattended Robot account can access the exact server path.
  • If you’re using a mapped drive such as Z:\, try using the UNC path instead, for example \\ServerName\Share\Config.xlsx.
  • Make sure the OneDrive file is actually synced/downloaded locally and isn’t cloud-only.
  • Verify that the Robot account has read permissions on both the share and the underlying folder/file.
  • Log the actual config file path before initialization and check File.Exists() from the unattended execution.
  • If the file is accessible, then verify that the config being loaded actually contains the Xyz key.

The error:

The given key ‘Xyz’ was not present in the dictionary

usually means the workflow is trying to access something like Config("Xyz"), but the dictionary created during initialization doesn’t contain that key. If the wrong/empty config file is being loaded because of the server/OneDrive path, you can get exactly this error even though the original config file contains Xyz.

I would first test the same path under the unattended Robot account. That should help determine whether the issue is with permissions/path/sync or with the config content itself.

Hi @Kumar_Chandrakant ,
The issue is usually not OneDrive itself, but that the robot is reading a different Config file (or an outdated sync copy) from the server location where the required key is missing. Verify the file path, sync status, permissions, and the presence of the key in that specific Config file.

Thanks

@Kumar_Chandrakant
I’d add a quick check just before loading the Config: log the exact file path being used and check if the file actually exists from the Robot session.

If the file is not found, check the server permissions, OneDrive sync status and preferably try the UNC path instead of a mapped drive.

If the file exists but Xyz is still missing, then the robot is most likely loading another or outdated copy of the Config. I’d open that exact file and verify the key there.

Hi @Kumar_Chandrakant,

Instead of this, you can create a OneDrive connection in Integration Services and access the config file from there. This way, you won’t have any dependency on the server.

Integration Service documentation:

Thanks!

@Kumar_Chandrakant

If you are open to refactor, you can store the config in Storage Bucket where it will be configurable without dependency on the OneDrive and locations.