Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] @azure-tools/typespec-python keyError: OperationGroups #2975

Open
l0lawrence opened this issue Dec 17, 2024 · 4 comments
Open

[bug] @azure-tools/typespec-python keyError: OperationGroups #2975

l0lawrence opened this issue Dec 17, 2024 · 4 comments
Assignees

Comments

@l0lawrence
Copy link
Member

l0lawrence commented Dec 17, 2024

With the recent typespec versioning updates to the rest-api-specs repo it looks like this error is back again for EventGrid System Events (a models only package): cmdout [automation_generate.sh] 2024-12-17 21:40:57 [ERROR] KeyError: 'operationGroups'

as seen here: https://github.com/Azure/azure-rest-api-specs/pull/31739/checks?check_run_id=34561185899

Was there a design change? I believe we ran into this before and resolved it.

@l0lawrence
Copy link
Member Author

l0lawrence commented Dec 17, 2024

Ah looks like this still might be open? #2630. But see here it passed.

@swathipil
Copy link
Member

I'm also seeing it after bumping from 0.35.1 to 0.37.1. Stack trace:

Error: Command failed: /home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/venv/bin/python /home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/eng/scripts/setup/run_tsp.py --output-folder=/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator --cadl-file=/tmp/cadl-codegen/python-yaml-path1cce935f-08a8-4ee4-82a0-c60f918da792.yaml --package-version=0.3.13 --generate-packaging-files=false --flavor=azure --package-dir=apiview-stub-generator --package-name=treestyle-parser --generate-test=false --generate-sample=false --models-mode=dpg --emit-cross-language-definition-file=true --from-typespec=true
Traceback (most recent call last):
  File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/eng/scripts/setup/run_tsp.py", line 41, in <module>
    codegen.CodeGenerator(output_folder=args.output_folder, cadl_file=args.cadl_file, **unknown_args).process()
  File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/generator/pygen/codegen/__init__.py", line 336, in process
    self.sort_exceptions(yaml_data)
  File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/generator/pygen/codegen/__init__.py", line 247, in sort_exceptions
    for group in client["operationGroups"]:
KeyError: 'operationGroups'

    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:882:11)
    at execSync (node:child_process:954:15)
    at $onEmit (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/dist/emitter/emitter.js:110:9)
    at async Object.$onEmit [as emitFunction] (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@azure-tools/typespec-python/dist/src/emitter.js:3:5)
    at async runEmitter (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/compiler/dist/src/core/program.js:366:13)
    at async compile (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/compiler/dist/src/core/program.js:123:9)
    at async compileTsp (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/typespec.js:97:21)
    at async generateCommand (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/commands.js:248:35)

--------------------------------------------------
Library Version                0.37.1
TypeSpec Compiler Version      0.63.0
--------------------------------------------------
    at runEmitter (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/compiler/dist/src/core/program.js:369:19)
    at async compile (file:///home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/compiler/dist/src/core/program.js:123:9)
    at async compileTsp (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/typespec.js:97:21)
    at async generateCommand (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/commands.js:248:35)
    at async updateCommand (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/commands.js:307:5)
    at async Object.handler (file:///home/swathip/.nvm/versions/node/v23.4.0/lib/node_modules/@azure-tools/typespec-client-generator-cli/dist/index.js:151:5) {
  info: {
    kind: 'emitter',
    metadata: {
      type: 'module',
      name: '@azure-tools/typespec-python',
      homepage: 'https://github.com/Azure/autorest.python',
      bugs: [Object],
      version: '0.37.1'
    },
    error: Error: Command failed: /home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/venv/bin/python /home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/eng/scripts/setup/run_tsp.py --output-folder=/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator --cadl-file=/tmp/cadl-codegen/python-yaml-path1cce935f-08a8-4ee4-82a0-c60f918da792.yaml --package-version=0.3.13 --generate-packaging-files=false --flavor=azure --package-dir=apiview-stub-generator --package-name=treestyle-parser --generate-test=false --generate-sample=false --models-mode=dpg --emit-cross-language-definition-file=true --from-typespec=true
    Traceback (most recent call last):
      File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/eng/scripts/setup/run_tsp.py", line 41, in <module>
        codegen.CodeGenerator(output_folder=args.output_folder, cadl_file=args.cadl_file, **unknown_args).process()
      File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/generator/pygen/codegen/__init__.py", line 336, in process
        self.sort_exceptions(yaml_data)
      File "/home/swathip/repos/azure-sdk-tools/packages/python-packages/apiview-stub-generator/TempTypeSpecFiles/apiview-treestyle-parser-schema/node_modules/@typespec/http-client-python/generator/pygen/codegen/__init__.py", line 247, in sort_exceptions
        for group in client["operationGroups"]:
    KeyError: 'operationGroups'

@msyyc msyyc self-assigned this Dec 18, 2024
@msyyc
Copy link
Member

msyyc commented Dec 18, 2024

Thanks for your feedback and let me take an investigation.

@msyyc
Copy link
Member

msyyc commented Dec 23, 2024

Update: I have found the root cause and will fix it ASAP.

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

No branches or pull requests

3 participants