Skip to content

Conversation

@parthea
Copy link
Contributor

@parthea parthea commented Sep 17, 2025

This PR resolves the issue where duplicate values for id could be added to state.yaml. When duplicate entries exist in state.yaml librarian seems to provide an empty generate-request.json which leads to the following error (see googleapis/librarian#2186):

Traceback (most recent call last):
  File "/app/./cli.py", line 261, in handle_generate
    request_data = _read_json_file(f"{librarian}/{GENERATE_REQUEST_FILE}")
  File "/app/./cli.py", line 100, in _read_json_file
    return json.load(f)
  File "/usr/local/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 31 column 2 (char 755)

See output below for google-cloud-dlp and google-cloud-eventarc which already exist in .librarian/state.yaml

partheniou@partheniou-vm-3:~/git/google-cloud-python/scripts/configure_state_yaml$ python3 configure_state_yaml.py 
Skipping package 'google-cloud-dlp' as it already exists in state.yaml.
Skipping package 'google-cloud-eventarc' as it already exists in state.yaml.

@parthea parthea requested review from a team as code owners September 17, 2025 01:22
@parthea parthea requested a review from jskeet September 17, 2025 01:22
Copy link
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this is what we do in the Go stategen tool.

@parthea parthea merged commit bf20f1c into main Sep 17, 2025
24 checks passed
@parthea parthea deleted the avoid-duplicate-entries branch September 17, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants