GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gapic-generator-java exits with `IllegalStateException` when there's no service in protos · Issue #2050 · googleapis/sdk-platform-java

This repository was archived by the owner on Oct 29, 2026. It is now read-only.
This repository was archived by the owner on Oct 29, 2026. It is now read-only.

gapic-generator-java exits with IllegalStateException when there's no service in protos #2050

Copy link
Copy link
Closed
#2460
Closed
gapic-generator-java exits with IllegalStateException when there's no service in protos#2050
#2460
Copy link
Assignees
diegomarquezp
Labels
priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Description

@JoeWang1127
JoeWang1127
opened on Sep 28, 2023
Issue body actions

The generator should return normally with no-op when there's no service in protos.

For example: when generating from google/cloud/alloydb/connectors/v1alpha, the generator exited with the following error:

Exception in thread "main" java.lang.IllegalStateException: No services found to generate
        at com.google.common.base.Preconditions.checkState(Preconditions.java:512)
        at com.google.api.generator.gapic.protoparser.Parser.parse(Parser.java:172)
        at com.google.api.generator.gapic.Generator.generateGapic(Generator.java:30)
        at com.google.api.generator.Main.main(Main.java:28)
--java_gapic_out: protoc-gen-java_gapic: Plugin failed with status code 1.

Activity

  1. JoeWang1127
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    priority: p2Moderately-important priority. Fix may not be included in next release.
    on Sep 28, 2023
  2. suztomo commented on Sep 28, 2023

    @suztomo
    suztomo
    on Sep 28, 2023
    Member
    More actions

    I would implement the script in a way that it would not call gapic-generator-java if there's no need to call it.

  3. JoeWang1127 commented on Sep 28, 2023

    @JoeWang1127
    JoeWang1127
    on Sep 28, 2023
    ContributorAuthor
    More actions

    I would implement the script in a way that it would not call gapic-generator-java if there's no need to call it.

    I'm currently working on this feature.

    However, generate_library.sh can't decide whether to invoke generator or not. This information is stored in BUILD.bazel: if there's no java_gapic_library target, then generate_library.sh should not call the generator.

    The grpc java plugin is implemented in a way that if there's no service to generate, it will exit normally without generating any code. I think the generator (which is also a protoc plugin) should do the same.

  4. blakeli0 commented on Sep 28, 2023

    @blakeli0
    blakeli0
    on Sep 28, 2023
    Contributor
    More actions

    We discussed this in the project meeting and I agree with Joe. In addition, we have other use cases that can benefit from this change. For example, as @mpeddada1 mentioned in googleapis/google-cloud-java#12478, we may need the generator to generate reflect-config.json for proto-only modules.

  5. blakeli0
    added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Dec 26, 2023
  6. blakeli0 commented on Dec 26, 2023

    @blakeli0
    blakeli0
    on Dec 26, 2023
    Contributor
    More actions

    This is working as intended, changing the type from bug to feature request.

  7. diegomarquezp
    self-assigned this
    on Feb 12, 2024
  8. diegomarquezp commented on Feb 13, 2024

    @diegomarquezp
    diegomarquezp
    on Feb 13, 2024
    Contributor
    More actions

    cc: @lqiu96 @JoeWang1127 @alicejli
    We will address this issue by strictly causing a no-op (no output is generated) whenever no services are generated. We will leave the noop + reflect-config.json as a follow up to be addressed separately (googleapis/google-cloud-java#12478)

    Some considerations:

    • Update documentation to explain that the generator will not fail but simply no-op
    • Add a log statement (stderr) indicating that no services will be generated
  9. diegomarquezp
    closed this as completedin #2460on Jun 10, 2024
  10. diegomarquezp
    added a commit that references this issue on Jun 10, 2024

    feat: gapic-generator-java to perform a no-op when no services are de…

    c0b5646
  11. chingor13
    added a commit that references this issue on Mar 24, 2026

    feat: gapic-generator-java to perform a no-op when no services are de…

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

Metadata

Metadata

Assignees

  • @diegomarquezp
    diegomarquezp

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.