spring-projects/spring-ai · warning
You have enabled logging out the image prompt content with…
Error message
You have enabled logging out the image prompt content with the risk of exposing sensitive or private information. Please, be careful!
What it means
A startup warning from Spring AI's image observation auto-configuration. Enabling spring.ai.image.observations.include-prompt=true causes image generation prompt content to be recorded in observations, risking exposure of sensitive or private information. The warning is logged once so the operator is aware of the trade-off.
Solutions
- Set spring.ai.image.observations.include-prompt=false in production configuration.
- Enable the flag only in a dev/test Spring profile so production does not inherit it.
- If the warning is accepted, silence the logger for ImageObservationAutoConfiguration in your logging config.
- Review who can access your tracing backend and add data-scrubbing if prompts must be recorded.
Example fix
// before (application.yml)
spring:
ai:
image:
observations:
include-prompt: true
// after
spring:
ai:
image:
observations:
include-prompt: false # enable only in dev profile Defensive patterns
Strategy: validation
Validate before calling
boolean risky = env.getProperty("spring.ai.image.observations.include-prompt", Boolean.class, false);
if (risky && isProductionProfile(env)) {
throw new IllegalStateException("image prompt logging must be disabled in production");
} Prevention
- Review image observation properties per environment during release checklists.
- Centralize observability flags in one profile-specific file to ease review.
- Ensure tracing backends enforce access control and retention limits.
- Document accepted-risk decisions when the flag stays enabled.
When it happens
Trigger: Setting spring.ai.image.observations.include-prompt=true (ImageObservationProperties.includePrompt) while the image observation auto-configuration beans are created, triggering logPromptContentWarning().
Common situations: Debugging image-model prompts in development and leaving the flag enabled when deploying; organizations with strict data-handling rules where prompt text must not leave the application; shared tracing backends where image prompts become visible to a wider audience.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- You have enabled the inclusion of the tool call arguments…
- void warn(String message)
- void warn(String message)
- You have enabled logging out of the query response content…
- You have enabled logging out the ChatClient completion…
AI-assisted analysis of spring-projects/spring-ai@98a7beda4f (2026-09-11).
Data as JSON: /api/errors/1039f6730a60443e.
Report an issue: GitHub.
Appendix: source
Thrown at auto-configurations/models/image/observation/spring-ai-autoconfigure-model-image-observation/src/main/java/org/springframework/ai/model/image/observation/autoconfigure/ImageObservationAutoConfiguration.java:52
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Auto-configuration for Spring AI image model observations.
*
* @author Thomas Vitale
* @author Jonatan Ivanov
* @since 1.0.0
*/
@AutoConfiguration
@ConditionalOnClass(ImageModel.class)
@EnableConfigurationProperties(ImageObservationProperties.class)
public class ImageObservationAutoConfiguration {
private static final Log logger = LogFactory.getLog(ImageObservationAutoConfiguration.class);
private static void logPromptContentWarning() {
logger.warn(
"You have enabled logging out the image prompt content with the risk of exposing sensitive or private information. Please, be careful!");
}
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(Tracer.class)
@ConditionalOnBean(Tracer.class)
static class TracerPresentObservationConfiguration {
@Bean
@ConditionalOnMissingBean(value = ImageModelPromptContentObservationHandler.class,
name = "imageModelPromptContentObservationHandler")
@ConditionalOnProperty(prefix = ImageObservationProperties.CONFIG_PREFIX, name = "log-prompt",
havingValue = "true")
TracingAwareLoggingObservationHandler<ImageModelObservationContext> imageModelPromptContentObservationHandler(
Tracer tracer) {
logPromptContentWarning();
return new TracingAwareLoggingObservationHandler<>(new ImageModelPromptContentObservationHandler(), tracer);
}View on GitHub (pinned to 98a7beda4f)