# RuntimeError: tf.placeholder() is not compatible with eager execution.

- **ID:** `tensorflow/placeholder-not-supported-eager`
- **Domain:** tensorflow
- **Category:** type_error
- **Error Code:** `PLH`
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Using tf.placeholder in TensorFlow 2.x where eager execution is enabled by default; placeholders are only for graph mode.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| tensorflow 2.15 | active | — | — |
| tensorflow 2.16 | active | — | — |
| tensorflow 2.17 | active | — | — |

## Workarounds

1. **Replace `tf.placeholder(tf.float32, shape=[None, 10])` with function arguments in eager mode. For example: `def model_fn(x): return tf.keras.layers.Dense(10)(x)`. Then call `model_fn(input_tensor)` directly.** (95% success)
   ```
   Replace `tf.placeholder(tf.float32, shape=[None, 10])` with function arguments in eager mode. For example: `def model_fn(x): return tf.keras.layers.Dense(10)(x)`. Then call `model_fn(input_tensor)` directly.
   ```
2. **If graph mode is required, use `tf.function` with input signatures: `@tf.function(input_signature=[tf.TensorSpec(shape=[None, 10], dtype=tf.float32)])`.** (90% success)
   ```
   If graph mode is required, use `tf.function` with input signatures: `@tf.function(input_signature=[tf.TensorSpec(shape=[None, 10], dtype=tf.float32)])`.
   ```

## Dead Ends

- **** — Disabling eager execution with `tf.compat.v1.disable_eager_execution()` works but loses TF2 benefits and is deprecated. (50% fail)
- **** — Replacing placeholder with `tf.Variable` fails because variables hold specific values, not input slots. (80% fail)
