Daniel Chaffelson created NIFI-15397:
----------------------------------------

             Summary: Gitlab Registry Client should not warn when initializing 
a new flow
                 Key: NIFI-15397
                 URL: https://issues.apache.org/jira/browse/NIFI-15397
             Project: Apache NiFi
          Issue Type: Bug
          Components: Flow Versioning
    Affects Versions: 2.7.2
            Reporter: Daniel Chaffelson


# GitHubFlowRegistryClient: Spurious WARNING on Initial Commit

**NiFi Version**: 2.7.2
**Component**: `org.apache.nifi.github.GitHubFlowRegistryClient`

## Issue

When committing a new flow to a GitHub-based Flow Registry, a WARNING-level 
bulletin and log message is generated:

```
GitHubFlowRegistryClient[id=69ec8416-019b-1000-4f1d-cd46d79cdb90] Unable to get 
content SHA for [flows/default/test-flow-commit.json] from branch [main] 
because content does not exist
```

The commit succeeds despite the warning. The file is created in the repository 
as expected.

## Hypothesis

The GitHubFlowRegistryClient appears to attempt fetching the content SHA before 
writing, likely to determine whether to create or update the file. For initial 
commits, the file doesn't exist yet, so this lookup fails and logs a WARNING.

This seems like expected behavior for new flows - the warning is cosmetic and 
may be better suited to DEBUG or INFO level.

## Reproduction

```bash
# Using NiFi 2.7.2 Docker and nipyapi CLI

# 1. Create a GitHub registry client
nipyapi ci ensure_registry --profile single-user \
  --client_name test-registry \
  --repo <owner>/<repo> \
  --provider github \
  --default_branch main \
  --repository_path flows

# 2. Create a process group
nipyapi canvas create_process_group --profile single-user \
  root my-test-flow "(100,100)"

# 3. Commit to registry (triggers the warning)
nipyapi versioning save_git_flow_ver --profile single-user \
  <pg_id> \
  --registry_client test-registry \
  --bucket default \
  --flow_name my-test-flow \
  --comment "Initial commit"

# 4. Check bulletins (within 5 minutes)
nipyapi bulletins get_bulletins --profile single-user

# 5. Check NiFi logs
docker logs <nifi-container> 2>&1 | grep "Unable to get content SHA"
```

## NiFi Log Output

```
2025-12-29 11:52:12,215 WARN [NiFi Web Server-37] 
o.a.nifi.github.GitHubFlowRegistryClient 
GitHubFlowRegistryClient[id=69ec8416-019b-1000-4f1d-cd46d79cdb90] Unable to get 
content SHA for [flows/default/test-flow-commit.json] from branch [main] 
because content does not exist
2025-12-29 11:52:15,074 INFO [NiFi Web Server-37] 
o.a.nifi.groups.StandardProcessGroup Set Versioned Component ID of 
StandardProcessGroup[identifier=69f11df9-019b-1000-57af-53fcdafa9c98,name=test-flow-commit]
 to af124ed8-37fe-3238-b476-e7fa239f7a15
```

## Suggestion

Consider logging "content does not exist" at DEBUG level when this occurs 
during an initial commit/create operation, reserving WARN for unexpected 
failures.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to