Troubleshooting Stega Encoding
What is Stega?
Val uses stega encoding to embed metadata into strings. This enables visual editing features in Val Studio by tracking which content corresponds to which location in your Val files.
When you see the ValEncodedString type in TypeScript, it indicates that the string contains steganography encoding. This type helps you identify which strings have hidden metadata for visual editing.
Decoding Stega Content
If you need to access the raw content without stega encoding, use the val.raw() function:
Disabling Stega for Specific Fields
To prevent stega encoding on a specific string field, use the .raw() method:
Important Notes
Keys of records and objects are never stega-encoded. Only the values of string fields are encoded by default.
Troubleshooting
Issue: Unexpected characters in strings
If you see unexpected invisible characters in your strings, they are likely stega-encoded. Use val.raw() to decode them or .raw() in the schema to disable encoding.
Issue: String comparisons failing
Stega-encoded strings may not match in direct comparisons. Always decode with val.raw() before comparing, or use .raw() in the schema for fields that need exact matching (like IDs, API keys, or enum values).
Issue: URLs or paths not working
If URLs or file paths contain stega encoding, they may not work correctly. Use s.string().raw() for URL and path fields in your schema.
Issue: External API rejecting data
When sending Val content to external APIs, decode it first with val.raw() or mark the field as .raw() in the schema to prevent issues with validation or processing.