Devr.AI icon indicating copy to clipboard operation
Devr.AI copied to clipboard

BUG: Invalid EMBEDDING_MAX_BATCH_SIZE Value Triggers ValueError in backend/config.py

Open itzsudipta opened this issue 10 months ago β€’ 5 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

What happened?

πŸ“Œ Issue Overview

EMBEDDING_MAX_BATCH_SIZE Crashes Application if Set to Non-Integer Value

πŸ” Steps to Reproduce

  1. Set the environment variable EMBEDDING_MAX_BATCH_SIZE to a non-integer value (e.g., abc or leave it empty).
  2. Run the application.
  3. The application attempts to convert the value to int in backend/config.py.
  4. Show the error.

🎯 Expected Behavior

The application should handle invalid or missing EMBEDDING_MAX_BATCH_SIZE values gracefully and fall back to a safe default without crashing.

🚨 Actual Behavior

If EMBEDDING_MAX_BATCH_SIZE is set to a non-integer value or is empty, the application crashes with a ValueError in backend/config.py.

πŸ“· Screenshot

πŸ’‘ Suggested Improvements

  • Add error handling in backend/config.py to catch invalid EMBEDDING_MAX_BATCH_SIZE values.
  • Use the default value if parsing fails.

Record

  • [x] I agree to follow this project's Code of Conduct
  • [x] I want to work on this issue

itzsudipta avatar Jan 15 '26 15:01 itzsudipta

Hi maintainers! πŸ‘‹

I would like to work on this issue.

It looks like the EMBEDDING_MAX_BATCH_SIZE in backend/config.py is currently setting a value that exceeds the expected limit, which triggers the ValueError during initialization.

I can fix this by:

  1. Investigating the validator logic in config.py.
  2. Adjusting the default value or adding a constraint check to ensure the batch size remains within valid limits.

Could you please assign this issue to me? I can submit a PR for this by tomorrow.

bnyashwanth avatar Jan 16 '26 11:01 bnyashwanth

@smokeyScraper Hi there! I created issue #244 and have just uploaded my fix. I noticed a concurrent PR was opened, but I would ask you to consider my PR because it includes error-handling logic that prevents the server from failing to start due to configuration typos.

itzsudipta avatar Jan 17 '26 09:01 itzsudipta

Hi @itzsudipta, thanks for pointing this out and for working on the fix πŸ‘
I’ve pushed PR #247 with a defensive fallback for EMBEDDING_MAX_BATCH_SIZE to prevent startup crashes when the env var is invalid or missing. Happy to adjust or improve it if needed, or even align with your approach if maintainers prefer a single consolidated solution. Leaving it to the maintainers to decide which PR fits best β€” I’m happy to help either way πŸ™‚

bnyashwanth avatar Jan 23 '26 06:01 bnyashwanth

Hi, I’m Mohammad, a BTech AI student exploring Devr.AI for GSoC. I’ve reviewed this issue and would like to work on fixing it if that’s okay. I’ll add proper validation and safe fallback for invalid values.

muhammadtihame avatar Jan 26 '26 14:01 muhammadtihame

Thanks for the update! Looks like there are already PRs addressing this. I’ll look for another issue to contribute to. Appreciate the work here πŸ™Œ

muhammadtihame avatar Jan 26 '26 14:01 muhammadtihame