wavetermdev/waveterm · error
ijson budget requires ijson
Error message
ijson budget requires ijson
What it means
IJsonBudget caps the number/size budget of ijson entries, so it is only meaningful when IJson mode is enabled. MakeFile rejects IJsonBudget > 0 with IJson = false because the budget could never be applied.
Source
Thrown at pkg/filestore/blockstore.go:131
// synchronous (does not interact with the cache)
func (s *FileStore) MakeFile(ctx context.Context, zoneId string, name string, meta wshrpc.FileMeta, opts wshrpc.FileOpts) error {
if opts.MaxSize < 0 {
return fmt.Errorf("max size must be non-negative")
}
if opts.Circular && opts.MaxSize <= 0 {
return fmt.Errorf("circular file must have a max size")
}
if opts.Circular && opts.IJson {
return fmt.Errorf("circular file cannot be ijson")
}
if opts.Circular {
if opts.MaxSize%partDataSize != 0 {
opts.MaxSize = (opts.MaxSize/partDataSize + 1) * partDataSize
}
}
if opts.IJsonBudget > 0 && !opts.IJson {
return fmt.Errorf("ijson budget requires ijson")
}
if opts.IJsonBudget < 0 {
return fmt.Errorf("ijson budget must be non-negative")
}
return withLock(s, zoneId, name, func(entry *CacheEntry) error {
if entry.File != nil {
return fs.ErrExist
}
now := time.Now().UnixMilli()
file := &WaveFile{
ZoneId: zoneId,
Name: name,
Size: 0,
CreatedTs: now,
ModTs: now,
Opts: opts,
Meta: meta,
}View on GitHub (pinned to a4447c1563)
Solutions
- Set opts.IJson = true whenever a positive IJsonBudget is intended.
- Reset IJsonBudget to 0 when ijson mode is disabled.
- When deriving opts from config, validate the pair (ijson, ijsonBudget) together before calling MakeFile.
Example fix
// before
opts := wshrpc.FileOpts{IJsonBudget: 100} // IJson not set
// after
opts := wshrpc.FileOpts{IJson: true, IJsonBudget: 100} Defensive patterns
Strategy: validation
Validate before calling
func validIJsonBudget(opts wshrpc.FileOpts) bool {
return opts.IJsonBudget <= 0 || opts.IJson
}
if !validIJsonBudget(opts) {
return fmt.Errorf("ijsonBudget set without ijson")
} Try / catch
if err := store.MakeFile(ctx, zoneId, name, meta, opts); err != nil {
if strings.Contains(err.Error(), "ijson budget requires ijson") {
opts.IJson = true
err = store.MakeFile(ctx, zoneId, name, meta, opts)
}
if err != nil {
return err
}
} Prevention
- Set IJson and IJsonBudget together as a pair.
- Reset IJsonBudget to 0 when ijson mode is disabled.
- Validate option pairs in a normalize step before MakeFile.
- Avoid merging partial FileOpts structs that carry stale budgets.
When it happens
Trigger: Calling MakeFile with opts.IJsonBudget set to a positive value while opts.IJson is false — usually by populating the whole FileOpts struct from a config/map where the budget key is present but the ijson flag was not enabled.
Common situations: Merging default FileOpts (which carry a nonzero IJsonBudget) with mode flags that disable ijson; a UI toggle turning ijson off while leaving the previously set budget in place; hand-written opts literals that set the budget but forget the flag.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- circular file cannot be ijson
- max size must be non-negative
- circular file must have a max size
- ijson budget must be non-negative
- offset must be non-negative
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/eaf55be739559eed.
Report an issue: GitHub.