Skip to content

[BUG] Fix NPE when creating match-all composable index template without inline template block (#22420) - #22630

Open
waterWang wants to merge 1 commit into
opensearch-project:mainfrom
waterWang:fix/index-template-npe-null-template
Open

[BUG] Fix NPE when creating match-all composable index template without inline template block (#22420)#22630
waterWang wants to merge 1 commit into
opensearch-project:mainfrom
waterWang:fix/index-template-npe-null-template

Conversation

@waterWang

Copy link
Copy Markdown

Description

Fixes #22420

When creating a composable index template with a match-all pattern (*) and no inline template block, the request validation in PutComposableIndexTemplateAction.validateIndexTemplate() throws a NullPointerException because it calls indexTemplate.template().settings() without checking if template() returns null.

Root Cause

indexTemplate.template() returns null when no inline template block is provided (which is valid per the API spec). The null reference is then dereferenced for .settings().

Fix

Added a null check for indexTemplate.template() before accessing .settings(). When template() is null, the hidden index validation is skipped (no inline settings to validate).

Related

Testing

  • Code compiles (the change is a single null-guard addition)
  • The existing test suite covers template validation; the null guard prevents the NPE path

@waterWang
waterWang requested a review from a team as a code owner August 1, 2026 22:53
@github-actions github-actions Bot added bug Something isn't working Cluster Manager labels Aug 1, 2026
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 6ff7f79:

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Cluster Manager

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[BUG] NPE when creating a match-all composable index template without an inline template block

1 participant