# Unable to serialize @Input List\<String\> from @Managed item in a Task using @Nested

**URL:** <https://discuss.gradle.org/t/unable-to-serialize-input-list-string-from-managed-item-in-a-task-using-nested/19518>\
**Category:** Bugs\
**Tags:** plugins\
**Created:** [September 13, 2016, 9:07pm UTC](https://discuss.gradle.org/t/unable-to-serialize-input-list-string-from-managed-item-in-a-task-using-nested/19518 "2016-09-13T21:07:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Appu\_Goundan](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/appu_goundan/32/774_2.png) [@Appu\_Goundan](https://discuss.gradle.org/u/Appu_Goundan)\
**Post date:** [September 13, 2016, 9:07pm UTC](https://discuss.gradle.org/t/unable-to-serialize-input-list-string-from-managed-item-in-a-task-using-nested/19518/1 "2016-09-13T21:07:15Z")

</div>

I believe this is a bug, but maybe it’s just not a supported features (seems unlikely)

Looks similar to this, but with a @Nested tag : [Workaround for @Input List\<String\> args is not serializable](https://discuss.gradle.org/t/workaround-for-input-list-string-args-is-not-serializable/17472)

I’m using @Nested to try to serialized a @Managed object in my task.

```gradle
public class PrintStringsTask extends DefaultTask {
  private TestModel testModel;

  @Nested
  public TestModel getTestModel() {
    return testModel;
  }
  
   @TaskAction ....
}

```

The managed object looks like this

```gradle
@Managed
public interface TestModel {

  @OutputDirectory
  File getTarget();
  void setTarget(File target);

  @Input
  List<String> getStrings();
  void setStrings(List<String> strings);
}

```

When I try to run the task, the serialization fails because it fails to serialize the List

```gradle
Could not add entry ':printStrings' to cache taskArtifacts.bin (/home/userX/src/listSerialization/test-project/.gradle/3.0/taskArtifacts/taskArtifacts.bin).
> Unable to store task input properties. Property 'testModel.strings' with value '[goose]' cannot be serialized.

```

If you try to figure out the type that it’s trying to serialize, you find it is

```gradle
org.gradle.model.internal.manage.schema.extract.ScalarCollectionNodeInitializerExtractionStrategy$ListBackedCollection

```

which doesn’t appear to be `Serializable`. What exactly is going here? Even if I seed the model element with an `ArrayList<String>()` (known Serializable), it’s converting it to a non-serializable collection when returning it from the Model and my task input/output saver just fails.

See Test project here [https://github.com/loosebazooka/listSerialization](https://github.com/loosebazooka/listSerialization) for recreation.
