# Bug: caviar\_egg\_sandwich does not have "spoils\_in"

**URL:** <https://discourse.cataclysmdda.org/t/bug-caviar-egg-sandwich-does-not-have-spoils-in/29563>\
**Category:** The Garage\
**Created:** [December 10, 2024, 9:57pm UTC](https://discourse.cataclysmdda.org/t/bug-caviar-egg-sandwich-does-not-have-spoils-in/29563 "2024-12-10T21:57:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@jeff](https://discourse.cataclysmdda.org/u/jeff)\
**Post date:** [December 10, 2024, 9:57pm UTC](https://discourse.cataclysmdda.org/t/bug-caviar-egg-sandwich-does-not-have-spoils-in/29563/1 "2024-12-10T21:57:57Z")

</div>

See [here](https://github.com/CleverRaven/Cataclysm-DDA/blob/52e00ebe666c7dbd4496b446d315fd785fcf16fb/data/json/items/comestibles/egg.json#L1142C12-L1142C31)

---

<div class="post-metadata">

**Author:** ![jeff](https://avatars.discourse-cdn.com/v4/letter/j/e19b73/32.png) [@jeff](https://discourse.cataclysmdda.org/u/jeff)\
**Post date:** [December 10, 2024, 10:04pm UTC](https://discourse.cataclysmdda.org/t/bug-caviar-egg-sandwich-does-not-have-spoils-in/29563/2 "2024-12-10T22:04:51Z")

</div>

You can run this python script in the comestibles directory - I don’t see any other issues, but maybe you will:

```auto
import os
import json

# Function to load and parse JSON files in the current directory
def load_json_files_in_directory(directory):
    json_files = [f for f in os.listdir(directory) if f.endswith('.json')]
    data = []
    for json_file in json_files:
        with open(os.path.join(directory, json_file), 'r') as file:
            try:
                data.append(json.load(file))
            except json.JSONDecodeError:
                print(f"Error decoding JSON in file: {json_file}")
    return data

# Function to find all "COMESTIBLE" items without a "spoils_in" value
def find_comestibles_without_spoils_in(data):
    items_without_spoils_in = []
    for file_data in data:
        for item in file_data:
            if item.get("type") == "COMESTIBLE" and item.get("comestible_type") == "FOOD" and "spoils_in" not in item and "copy-from" not in item:
                # Check if the "id" field exists in the item before accessing it
                if "id" in item:
                    items_without_spoils_in.append(item["id"])
    return items_without_spoils_in

# Set the directory to the current directory where the script is located
directory = "."

# Load all JSON data from the files in the directory
data = load_json_files_in_directory(directory)

# Find all "COMESTIBLE" items that don't have "spoils_in"
items_without_spoils_in = find_comestibles_without_spoils_in(data)

# Print the list of item "id"s without "spoils_in"
for item_id in items_without_spoils_in:
    print(item_id)

```
