{'error': 'server returned a non-200 status code: 500'} when trying to add mount / volume to machine!

When I attempt to attach a volume via the fly.io machines api it gives me this cryptic error message.

payload = {
        "config": {
            "region": "jnb",
            "init": {},
            "image": f"ollama/ollama:latest",
            "auto_destroy": True,
            "restart": {"policy": "always"},
            "mounts": [
                {
                    "name": "ollama",
                    "path": "/root/.ollama",
                    "size_gb": 10,
                }
            ],
            "services": [
                {
                    "internal_port": 11434,
                    "protocol": "tcp",
                }
            ],
            "guest": {
                "cpu_kind": "performance",
                "cpus": 2,
                "memory_mb": 8192,
                # "gpus": 1,
                # "gpu_kind": "a100-pcie-40gb",
            },
        }
    }

    response = requests.post(url, json=payload, headers=headers)

    print(response.json())
    return response.json()

This just prints out this message:
{‘error’: ‘server returned a non-200 status code: 500’}

And when I make the volumes / mounts have 0 items , It successfully creates the image.

I have a volume with the same name in my app, which I created manually (It gave the same error when the volume wasn’t there, so I assume this isn’t a name collision.)

For now I can’t really do anything, because there is quite a bit of infrastructure that we are working on that relies on volumes (Selfhosting AI infrastructure seems to be cheaper than openai, and works better for our usecase)

From General to Questions / Help

Hi @AdonisCodes—thanks for posting. Could you try specifying a volume ID in the mounts section instead and let me know if that works? That is,

"mounts": [
    {
        "volume": "vol_XXX",
        "path": "/root/.ollama",
    }
],

where vol_XXX is the ID of the volume you’d like to attach the Machine to.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.