ERROR source prechecks failed: malformed charm url in database

Hello

I have an openstack environment deployed and some of the charms where cs: sourced. juju version is 3.1.2 , controller was 3.0.0 , updated to 3.1.1

Now, i ended up with a number of applications in the model which have no version available and no revision.

I cannot run any command, refresh ,migrate, nothing as i get these errors

ERROR source prechecks failed: malformed charm url in database: “cs:barbican-46”

List of apps that don’t have and charm name channel or revision:

App Version Status Scale Charm Channel Rev Exposed Message

barbican 0 0 no

barbican-mysql-router 0 0 no

barbican-vault 0 0 no

glance-simplestreams-sync 0 0 no

ntp 0 0 no

octavia-dashboard 0 0 no

octavia-diskimage-retrofit 0 0 no

Can someone tell me how should i proceed ? Some errors:

juju refresh ntp

ERROR cannot parse URL “cs:ntp-47”: schema “cs” not valid

juju remove-application barbican

ERROR removing application barbican failed: cannot parse URL “cs:barbican-46”: schema “cs” not valid

As you can see NO command works and I am stuck as I need to deploy 2 more computes, and they are in blocked state since ntp cannot be installed.

How can I locally modify these charms to set the correct name and fix the problem?

Thanks

Juju 3.1 dropped support for charm store charms and transitioning from 2.9->3,1 should have correctly updated your database. Can you provide the steps you took to get to where you are so we can understand what went wrong?

We will likely need to make some database updates to recover the situation. To help figure out what needs doing, can you provide a dump of the application, unit, and charm collections. export JUJU_DEV_FEATURE_FLAGS=develop-mode juju dump-db

We’d just need the app and unit name and charm url attributes, plus the charm collection details from the above output. We’d need to confirm that the charm store cs charms which are in the database also exist on charmhub and then we can look at updating the url prefixes to ch.

I managed to fix it, tinkering with juju’s mongodb.

modified the collections ‘charms’ ‘applications’ and ‘settings’ while changing the old urls cs:charm-version to ch:amd64/focal/charm-version to all occurences, and then copying the settings for those from the ‘settings’ collection so that the unique id reflected the new ch: url at the end, since the id cannot be edited in mongodb

it took me 2 days to figure out the structure but once i made the modifications and revisions and versions appeared on juju status, i removed the apps and redeployed successfully

Another thing that helped me was to deploy a second controller on my openstack private cloud and deploy one of the apps that where in charm store to see the new URL and settings.