Skip to content

NotFoundError

Problem

I created a new deployment version, or made a request to a deployment or pipeline, and the build/request failed. In the logs I see an error like:

NotFoundError: no resources found

or

NotFoundError: File not found

Solution

The most likely cause of this error is that a filepath you use in your code does not function properly in the UbiOps environment. When accessing a file in your deployment package from within your deployment package, you need to prepend the relative path with the base_directory. Like this:

import os

path_to_file = os.path.join(base_directory, 'your/rel/path')
path_to_file = file.path(base_directory, 'your/rel/path')

The base_directory is the absolute path to the directory where your deployment.py is located. It is a variable that is passed by UbiOps in the Deployment class (Python) or the init/request method (R).