Skip to content

core-keeper fails to initialize due to database and service version mismatch when in devel #5343

@bmeneg

Description

@bmeneg

🐞 Bug Report

Affected Services [REQUIRED]

This issue occurs when developing edgex-go with service VERSION not set, forcing Makefile to set it to 0.0.0.

Is this a regression?

No. It's present since the introduction of migration schema in version 4.0.0 (Odessa)

Description and Minimal Reproduction [REQUIRED]

When working on an development environment with no VERSION file set, during the Make the follow is set for the service version:

VERSION=$(shell cat ./VERSION 2>/dev/null || echo 0.0.0)
DOCKER_TAG=$(VERSION)-dev

GOFLAGS=-ldflags "-s -w -X github.com/edgexfoundry/edgex-go.Version=$(VERSION) $(ENABLE_FULL_RELRO_GOFLAGS)" -trimpath -mod=readonly

Thus the version 0.0.0 is set to edgex-go, which conflicts with the hardcoded initialVersion version set in the migration schema for postrgres 4.0.0-dev. This happens because when the migration code check if any migration is required the service version 0.0.0 is way behind the hardcoded version set, thus the code errors out, causing keeper to not initialize any database connection. Even though edgex-go still starts, any service that depends on keeper (like metadata) fails with Oops!!! metadata service is unavailable! in the UI.

🔥 Exception or Error


edgex-core-keeper | level=WARN ts=2026-01-05T05:55:07.076544396-03:00 app=core-keeper source=database.go:145 msg="couldn't create database client: postgres client creation failed -> TableManager failed to run SQL script
s -> core-keeper detects that the most recent successful version record (4.0.0-dev) in schema_migrations table is above service version 0.0.0"

🌍 Your Environment

Deployment Environment:
Fedore 42 Workstation
Docker version 29.1.3

EdgeX Version [REQUIRED]:
Above Odessa release (v4.0.0)

Anything else relevant?
Preparing an PR to fix it by considering the default development version 0.0.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions