I was validating a scenario where, if I provide a commit ID that is not present in the repository, the Config Client should use the second value from the property:

spring.cloud.config.label=${COMMIT_ID},${BRANCH}

Test 1

I passed the following commit ID from the Config Client to the Config Server: COMMIT_ID=f7a5dafbe969da489f1282bc70f870a160a66c5f

In this case, the Config Server threw a RefNotFoundException, and the client then retried using the branch name. This behavior was expected.

Test 2

Next, I passed another non-existent commit ID: COMMIT_ID=77a5dafbe969da489f1282bc70f870a160a66c5f

In this case, I received an IOException, and the Config Client failed to start.

So, even though both commit IDs are invalid and not present in the repository, they resulted in different exceptions — RefNotFoundException in one case and IOException in another.

Config Server Configuration

spring.cloud.config.server.git.uri=https://github.com/example-org/config-repo.git spring.cloud.config.server.git.username=your-username spring.cloud.config.server.git.password=your-password spring.cloud.config.server.git.search-paths=app1/ spring.cloud.config.server.default-label=development spring.cloud.config.server.git.basedir=/tmp/config-repo spring.cloud.config.server.git.clone-on-start=false spring.cloud.config.server.git.refresh-rate=0 spring.cloud.config.server.git.skipSslValidation=false spring.cloud.config.server.git.deleteUntrackedBranches=true spring.cloud.config.server.git.force-pull=true spring.cloud.config.server.git.pattern=

Config Client Configuration

spring.application.name=service spring.config.import=optional:configserver:${CONFIG_SERVER_URI} spring.cloud.config.fail-fast=true spring.cloud.config.label=${COMMIT_ID},${BRANCH}

spring.cloud.config.retry.max-attempts=5 spring.cloud.config.retry.max-interval=5000 spring.cloud.config.retry.initial-interval=2000 spring.cloud.config.retry.multiplier=1.5

Observation

Two different commit IDs that are both invalid led to different exception types:

  • RefNotFoundException — handled correctly, fallback to branch.
  • IOException — caused client startup failure.

Why there are two behavior ?

Comment From: ryanjbaxter

Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.

Comment From: jiten686

@ryanjbaxter It is just simple Application with following main class and build.gradle dependency

`@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}

`

`ext {
    set('springCloudVersion', "2023.0.3")
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter'
    implementation 'org.springframework.cloud:spring-cloud-config-server'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
    }
}

`

Comment From: jiten686

While debugging, it was observed that both exceptions are thrown from the resolve(String revstr) method in the org.eclipse.jgit.Repository class.

Comment From: ryanjbaxter

I tried to reproduce this using a supported version of Spring Cloud (2024.0.3 and 2025.0.0, 2023.0.x is no longer supported) but I cannot. The config server throws a org.eclipse.jgit.errors.MissingObjectException and that results in the client failing to start since fail-fast is set to true

Comment From: spring-cloud-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-cloud-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.

Comment From: jiten686

@ryanjbaxter While researching the above issue, I found that if the commit ID is not in the proper format (i.e., it must consist only of digits 0–9 and lowercase letters a–f), then RefNotFoundException is thrown. However, if the commit ID is in the correct format but does not exist in the local repository, then MissingObjectException is thrown. If my understanding above is correct, then the use case I was trying to validate is not a valid one. Could you please confirm?