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

Critical error generating HTTP #6268

Closed
mikekistler opened this issue Mar 12, 2025 · 5 comments · Fixed by #6356
Closed

Critical error generating HTTP #6268

mikekistler opened this issue Mar 12, 2025 · 5 comments · Fixed by #6356
Assignees
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience WIP
Milestone

Comments

@mikekistler
Copy link
Member

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Nuget tool

Client library/SDK language

None

Describe the bug

I am trying to generate HTTP snippets for the Catalog.API in eShop. Here's what happens

>kiota generate --openapi src/Catalog.API/Catalog.API_v2.json --language HTTP --output src/Catalog.API/HTTP
crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: An item with the same key has already been added. Key: api%2Dversion

Not sure what it's complaining about here, but api-version is a parameter on every operation.

Expected behavior

The API description is valid (no errors reported by Spectral validator) so I would expect no critical errors from Kiota.

I would also expect much better information about the error. The message displayed by Kiota gives me no clue about why this is a problem or how I would fix it.

How to reproduce

Clone the eShop repo and run the kiota command I showed above from the root of the repo.

Open API description file

Catalog.API_v2.json

Kiota Version

1.24.0+938d45efe40350345da733b1025af0cdaf31eea7

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

-OS: MacOS Sequoia 15.3 on Apple M1 MacBook

Debug output

Click to expand log ```
</details>


### Other information

_No response_
@mikekistler mikekistler added status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience labels Mar 12, 2025
@github-project-automation github-project-automation bot moved this to Needs Triage 🔍 in Kiota Mar 12, 2025
@Onokaev
Copy link
Contributor

Onokaev commented Mar 16, 2025

Hey @mikekistler, you need to pass --clean-output as an argument. Seems like there's already a client in your output directory

@mikekistler
Copy link
Member Author

@Onokaev I tried adding --clean-output but I'm getting the same error:

>kiota generate --openapi src/Catalog.API/Catalog.API_v2.json --language HTTP --output src/Catalog.API/Catalog.API.generated.http --clean-output
A newer version of Kiota (1.24.1) is available. You are currently using version 1.24.0. https://aka.ms/get/kiota
crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: An item with the same key has already been added. Key: api%2Dversion

@maisarissi
Copy link
Contributor

Can you try to delete any files that might exist in src/Catalog.API/Catalog.API.generated.http and try to run the command again and see if you are getting any errors?

@mikekistler
Copy link
Member Author

Same result:

>rm -rf src/Catalog.API/Catalog.API.generated.http 
>ls src/Catalog.API/Catalog.API.generated.http 
ls: src/Catalog.API/Catalog.API.generated.http: No such file or directory
>kiota generate --openapi src/Catalog.API/Catalog.API_v2.json --language HTTP --output src/Catalog.API/Catalog.API.generated.http --clean-output
A newer version of Kiota (1.24.1) is available. You are currently using version 1.24.0. https://aka.ms/get/kiota
crit: Kiota.Builder.KiotaBuilder[0]
      error generating the client: An item with the same key has already been added. Key: api%2Dversion

@Onokaev
Copy link
Contributor

Onokaev commented Mar 18, 2025

There's a bug with the generation. We'll fix it and share an update here.
Apologies for the inconvenience

@Onokaev Onokaev moved this from Needs Triage 🔍 to New📃 in Kiota Mar 18, 2025
@Onokaev Onokaev added this to the Kiota v1.25 milestone Mar 18, 2025
@Onokaev Onokaev self-assigned this Mar 18, 2025
@github-project-automation github-project-automation bot moved this from New📃 to Done ✔️ in Kiota Apr 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:waiting-for-triage An issue that is yet to be reviewed or assigned type:bug A broken experience WIP
Projects
Status: Done ✔️
Development

Successfully merging a pull request may close this issue.

3 participants